MySQL Получите последний 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); 
Cerbrain