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. Link to comment https://forums.phpfreaks.com/topic/264264-sharing-ids/ 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. Link to comment https://forums.phpfreaks.com/topic/264264-sharing-ids/#findComment-1354270 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.