php mysql get the last inserted id code example
Example 1: get last inserted id in php
Example (MySQLi Procedural)
$last_id = mysqli_insert_id($conn);
Example 2: mysql get the last id php
// Insert query
$query = "insert into users(username,fname,lname) values('sonarika','Sonarika','Bhadoria')";
mysqli_query($con,$query);
// Get last insert id
$lastid = mysqli_insert_id($con);