otuatail Posted October 12, 2007 Share Posted October 12, 2007 Is there a wat to capture Autonumber id of an inserted record. I need to add a record to table A and place the unique Autonumber id in table B TIA Desmond. Link to comment https://forums.phpfreaks.com/topic/72927-solved-capture-autonumber-id/ Share on other sites More sharing options...
Aureole Posted October 12, 2007 Share Posted October 12, 2007 Yes there is, I believe this is how you do it but this is only off the top of my head. <?php $query= "..."; $result = mysql_query($query); $insert_id = mysql_insert_id($result); // Now you can use $insert_id for your second query... $query2 = "INSERT INTO `...` (id, something, somethingelse) VALUES ('{$insert_id}', 'value', 'another value')"; $result2 = mysql_query($query2); // ... ?> Link to comment https://forums.phpfreaks.com/topic/72927-solved-capture-autonumber-id/#findComment-367764 Share on other sites More sharing options...
otuatail Posted October 12, 2007 Author Share Posted October 12, 2007 Great thanks for that worked fine TIA Desmond. Link to comment https://forums.phpfreaks.com/topic/72927-solved-capture-autonumber-id/#findComment-367818 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.