I am trying to do 3 simultaneous inserts into 3 tables as the user registers to my site.
Here are my tables:
UPDATED ANSWER. simplified the question:
Table 1
ControlPanelID
UserDescription
ChannelCommentsID
UserID
Table 2
UserID
UserName
Password
Email
Reputation
ControlPanelID
Role
Here are my 3 insert Statements:
$queryString=
"INSERT INTO ControlPanel VALUES("",ChannelCommentsID , userID)".
"INSERT INTO users VALUES($userNam,$pass,$email, ,'anonym')";
I want the UserID row to increment in both tables..how is that being acheived?
in other words opening the connection to the database twice… (i.e. 2 queries)?
You may use LAST_INSERT_ID() to get the value of the AUTOINCREMENT column for the previous INSERT.
In your specific case, this may be a possible solution