In web designing there are many reasons when we need to last inserted record id. You can do it with PHP if you will use auto increment in ID. Following code guide you to achieve this.
$servername = "localhost";
$username = "root";
$password = "your password";
$dbname = "your db name";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$servername = "localhost";
$username = "root";
$password = "your password";
$dbname = "your db name";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}