insert data and get last id

 $sql = "INSERT INTO MyGuests (firstname, lastname, email)

VALUES ('John', 'Doe', 'john@example.com')";

$last_id = mysqli_insert_id($conn);

Comments