how to get the id of the inserted row in mysqli
snippet in sql

how to get the id of the inserted row in mysqli

user6349

if ($conn->query($sql) === TRUE) {
    $last_id = $conn->insert_id;
    echo "New record created successfully. Last inserted ID is: " . $last_id;
} else {
    echo "Error: " . $sql . "<br>" . $conn->error;
}