我无法在db中插入许多id,因为它只允许最后一次INSERT

时间:2017-09-26 15:17:34

标签: php mysqli insert sql-insert

$AddRecord6 = mysqli_query($con,"INSERT INTO tbl_t_records(PerformanceID,QuizID,ProjectID,ExamID,AttendanceID,fuck) 
        VALUES(LAST_INSERT_ID(),LAST_INSERT_ID(),LAST_INSERT_ID(),LAST_INSERT_ID(),LAST_INSERT_ID(),'1')")or die(mysqli_error($con));

我不能使用多个LAST_INSERT_ID()它只允许第一个LAST_INSERT_ID(),我不能使用MAX(id),因为它不好

1 个答案:

答案 0 :(得分:0)

首先在PHP中获取最后一个插入ID!

$lastId = mysqli_insert_id($conn);