I'd like to know the right and proper practice to handle auto_increment in this table structure problem. Let's say I have these table:
StudentMaster
ID auto_increment name varchar(100) Status int(11) StudentDetail
ID varchar(10) examID varchar(20) examDate date When I insert a data to StudentMaster and StudentDetail in one action, how to make the ID in StudentDetail has the same value with StudentMaster? Because in the new form, there is no textbox containing ID to be inputted.
Data example:
ID Name Status 1 Roy 1 2 Nicole 2 ID examID examDate 1 A1 2017-05-15 1 A2 2017-05-15 1 A5 2017-05-17 2 A2 2017-05-15 1 A3 2017-05-16 P.S: I am in the database structure phase. The PHP form is not created yet.
SELECT LAST_INSERT_ID();returns 0 ??