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? Link to comment https://forums.phpfreaks.com/topic/59028-solved-getting-the-value-of-a-field/ 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 Link to comment https://forums.phpfreaks.com/topic/59028-solved-getting-the-value-of-a-field/#findComment-293015 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! Link to comment https://forums.phpfreaks.com/topic/59028-solved-getting-the-value-of-a-field/#findComment-293018 Share on other sites More sharing options...
suma237 Posted July 9, 2007 Share Posted July 9, 2007 use mysql_insert_id Link to comment https://forums.phpfreaks.com/topic/59028-solved-getting-the-value-of-a-field/#findComment-293020 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.