joinx Posted May 8, 2008 Share Posted May 8, 2008 How to select and retrieve data that has been inserted from the last row of a table...? Link to comment https://forums.phpfreaks.com/topic/104725-fetch-last-row-in-a-table/ Share on other sites More sharing options...
BlueSkyIS Posted May 8, 2008 Share Posted May 8, 2008 use ORDER BY DESC (descending) in your query, for instance: SELECT * FROM some_table ORDER BY name DESC then take the first record. alternatively, you might use MAX() to pull the max value of a column. Link to comment https://forums.phpfreaks.com/topic/104725-fetch-last-row-in-a-table/#findComment-536025 Share on other sites More sharing options...
moselkady Posted May 8, 2008 Share Posted May 8, 2008 If you have a filed, e.g. id, that is auto incremented, you can try this SELECT * FROM mytable ORDER BY id DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/104725-fetch-last-row-in-a-table/#findComment-536026 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.