m4x3vo Posted July 20, 2009 Share Posted July 20, 2009 Hi, How can I grab the newest mysql entry from a table where the user_id = 1. Link to comment https://forums.phpfreaks.com/topic/166690-solved-how-do-you-grab-the-most-recent-entry/ Share on other sites More sharing options...
rhodesa Posted July 20, 2009 Share Posted July 20, 2009 is there a field in the table that is auto_incrementing? if so, let's assume it's called row_id: SELECT * FROM tableName WHERE user_id = 1 ORDER BY row_id DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/166690-solved-how-do-you-grab-the-most-recent-entry/#findComment-878949 Share on other sites More sharing options...
gizmola Posted July 20, 2009 Share Posted July 20, 2009 What is the structure of the table? Does it have a timestamp or datetime column? Link to comment https://forums.phpfreaks.com/topic/166690-solved-how-do-you-grab-the-most-recent-entry/#findComment-878950 Share on other sites More sharing options...
m4x3vo Posted July 20, 2009 Author Share Posted July 20, 2009 Forgot to tell you, there is no id column or timestamp.. Link to comment https://forums.phpfreaks.com/topic/166690-solved-how-do-you-grab-the-most-recent-entry/#findComment-878963 Share on other sites More sharing options...
rhodesa Posted July 20, 2009 Share Posted July 20, 2009 Forgot to tell you, there is no id column or timestamp.. then i would recommend adding one Link to comment https://forums.phpfreaks.com/topic/166690-solved-how-do-you-grab-the-most-recent-entry/#findComment-878968 Share on other sites More sharing options...
m4x3vo Posted July 20, 2009 Author Share Posted July 20, 2009 Lol forgot you can add in an id column even when there are entries, thanks. Link to comment https://forums.phpfreaks.com/topic/166690-solved-how-do-you-grab-the-most-recent-entry/#findComment-878969 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.