me1000 Posted July 9, 2007 Share Posted July 9, 2007 hia, So I have a column in a database called ID which is set to auto-increment so when I add a new entry to the database the number is one larger than the previous entry. is there an easier way than this $query = "SELECT ID FROM table ORDER DESC LIMIT 1"; $page_id = mysql_fetch_array(mysql_query($query)); to get the value of ID in the last entry? Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted July 9, 2007 Share Posted July 9, 2007 why is this such a common question? http://us.php.net/manual/en/function.mysql-insert-id.php Quote Link to comment Share on other sites More sharing options...
me1000 Posted July 9, 2007 Author Share Posted July 9, 2007 DUDE! you are my HERO!!!!! Thanks a million! Quote Link to comment Share on other sites More sharing options...
suma237 Posted July 9, 2007 Share Posted July 9, 2007 use mysql_insert_id 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.