0
$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));

I cannot Use Multiple LAST_INSERT_ID() it only permits the first LAST_INSERT_ID() and I cannot use the MAX(id) because it is not good

  • So, you want to store LAST_INSERT_ID() into multiple fields of the same table? – Manav Sep 26 '17 at 15:20
  • The PerformanceID,QuizID,ProjectID are all Foreign Keys, I inserted records for Quiz Table, Performance Table Project Table, Exam Table And Attendance Table, So in the $AddRecord6 Query I will insert all the LAST INSERTED ID of the Tables but it only permits 1 Table –  Sep 26 '17 at 15:25
  • You do know right that LAST_INSERT_ID() is exactly what it says, the _last_ inserted auto-increment id. So all the values for it will be equal; you are inserting identical values into the fields of this table, based on _only one_ previous query – Manav Sep 26 '17 at 15:32
  • Thank you very much sir. So how can I make it unidentical? –  Sep 26 '17 at 15:38
  • I'll give you the full query dir –  Sep 26 '17 at 15:39

1 Answers1

0

Get the last insert ID in PHP first!

$lastId = mysqli_insert_id($conn);
delboy1978uk
  • 12,118
  • 2
  • 21
  • 39