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. Quote Link to comment 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); // ... ?> Quote Link to comment 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. 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.