BK201 Posted June 15, 2012 Share Posted June 15, 2012 I'm quite new to SQL, I'm creating a database and I would like to have an id in table B that is tables A's primary key. I'm can't seem to find the command to do this. Thanks guys. Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted June 15, 2012 Share Posted June 15, 2012 You can use MySQL's LAST_INSERT_ID() function, or php's mysql_insert_id immediately after the INSERT query to get the primary key id to insert into the second table. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.