1// Insert query
2$query = "insert into users(username,fname,lname) values('sonarika','Sonarika','Bhadoria')";
3
4mysqli_query($con,$query);
5
6// Get last insert id
7$lastid = mysqli_insert_id($con);
1 $db = db_connect();
2 $query = $db->query("SELECT * FROM users ORDER BY id DESC LIMIT 1");
3 $result = $query->getRow();