the two tables cannot both have an auto-incrementing field that is used for the same purpose. one of those tables, will need to have a foreign key that points to the primary key in the opposite.
To actually do the double insert, you would need to do the insert into the table with the auto-incrementing user_id field
By checking that INSERT for no errors, you will than be able to do a second query that grabs the last inserted id, then once you have the last inserted user_id, you may do a second insert query to put the second record in the second table
Code:
if(query(INSERT...))
{
$user_id = fetch_array(query(SELECT user_id FROM ___ ORDER BY user_id DESC LIMIT 1));
if($user_id>0)
{
query(INSERT....)
}
}
Bookmarks