Guys I am having a problem using mysql_insert_id() function
Here is the result if ill execute my first query:
result:
id user Fullname Yrlvl etc
10 1232 Patrick 2015
$form_data = array('id'=>'','user' => $user, 'pass'=>$pass, 'fname'=>$fname,'mname'=>$mname,'lname'=>$lname,
'contact'=>$contact, 'email'=>$email, 'yrlvl'=>$yrlvl, 'user_type'=>'student','date_registered'=>'');
$query = dbRowInsert('account', $form_data)
====================================================
Next When I will execute my 2nd query
mysql_query("insert into student_section (`id`,`sname`,`user`) values (".mysql_insert_id().",'$sname', '$user')");
Here is the result
secid id Sname User
1 10 Sample 1232
But If i will execute my last query
mysql_query("insert into first (`id`,`subject`,`grade`)
values (".mysql_insert_id().", 'Filipino', '0'),
('$userid', 'English', '0'),
('$userid', 'Mathematics','0'),
('$userid', 'Science', '0'),
('$userid', 'Araling Panlipunan', '0'),
('$userid', 'Technological and Livelihood Education', '0'),
('$userid', 'Music, Arts, Physical Education and Health', '0'),
('$userid', 'Edukasyon sa Pagpapahalaga', '0'),
('$userid', 'Computer Education', '0')
") or die(mysql_error());
firstid id subject grade
1 1 english 95
My Problem is after I executed my last query the ID it will get was the secid of the 2nd query not the id.
I hope you can help me