i am trying to insert to a table and get the ID of the new row.
$mysqli = new mysqli("localhost", "dbuser", "dbpass", "dbname");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$query = "INSERT INTO table (tbl1,tbl2,tbl3,tbl4,tbl5) VALUES ('".$tbll."','".$tbl2."','".$tbl3."','0.00','".$tbl5."'";
$mysqli->query($query);
$id_log = $mysqli->insert_id;
- id_log is returning 0 no error anywhere in logs
- on same file i am doing SELECT & UPDATE and all work perfectly