我正在尝试插入表格并获取新行的ID。
$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;
答案 0 :(得分:3)
你错过了一个括号......
$query = "INSERT INTO table (tbl1,tbl2,tbl3,tbl4,tbl5) VALUES ('".$tbll."','".$tbl2."','".$tbl3."','0.00','".$tbl5."')";
----------------------------------------------------------^