mitch.craig Posted August 29, 2008 Share Posted August 29, 2008 I know this should be simple but im trying to select everything from the entry with the highest Id (i.e the most recent entry) I have tried a few ideas but i just keep getting "supplied argument is not a valid MySQL result resource". Please help. Link to comment https://forums.phpfreaks.com/topic/121872-solved-selecting-record-with-maximum-id/ Share on other sites More sharing options...
rhodesa Posted August 29, 2008 Share Posted August 29, 2008 post what you have so far...but it should look something like: SELECT * FROM `tablename` ORDER BY `id` DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/121872-solved-selecting-record-with-maximum-id/#findComment-628817 Share on other sites More sharing options...
fenway Posted August 29, 2008 Share Posted August 29, 2008 That error message means you didn't execute a sucessful query... but MAX(id) is the better way to go... the question is why you need this. Link to comment https://forums.phpfreaks.com/topic/121872-solved-selecting-record-with-maximum-id/#findComment-628843 Share on other sites More sharing options...
rhodesa Posted August 29, 2008 Share Posted August 29, 2008 ...im trying to select everything from the entry with the highest Id (i.e the most recent entry)... ...so use mine, not the MAX() way as that will only get you the ID Link to comment https://forums.phpfreaks.com/topic/121872-solved-selecting-record-with-maximum-id/#findComment-628852 Share on other sites More sharing options...
fenway Posted August 29, 2008 Share Posted August 29, 2008 Oops, missed the "everything" part... Link to comment https://forums.phpfreaks.com/topic/121872-solved-selecting-record-with-maximum-id/#findComment-628856 Share on other sites More sharing options...
mitch.craig Posted August 29, 2008 Author Share Posted August 29, 2008 Thanks. That worked perfectly!! Link to comment https://forums.phpfreaks.com/topic/121872-solved-selecting-record-with-maximum-id/#findComment-628867 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.