jonniejoejonson Posted December 18, 2007 Share Posted December 18, 2007 I want to insert 'message' details into a table that has an autoincrement int. This integer servers as the unique index for the message. However I need to select this index number as it is inserted so that I can store it in another table... do you know how to do this... $sql= "INSERT INTO messages (date,subject,message) VALUES (NOW(),'$subject','$message') I then want to select the 'messageindex' for this inserted row"; (messageindex is the autoincrement integer) thanks to any responders. Quote Link to comment Share on other sites More sharing options...
p2grace Posted December 18, 2007 Share Posted December 18, 2007 $id = mysql_insert_id(); Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted December 18, 2007 Share Posted December 18, 2007 $id = mysql_insert_id(); OMG that will be very helpful for me! Quote Link to comment Share on other sites More sharing options...
jonniejoejonson Posted December 18, 2007 Author Share Posted December 18, 2007 Thanks alot p2grace, that works perfect. 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.