mikeymizrahi Posted April 8, 2007 Share Posted April 8, 2007 I am trying to set up a very very simple CMS for a website- a status update. I am using an html form to post to a database and am then displaying the "status." When I display the status, it shows all the previous entries- Is there a function to display the last or most recent entry? I have tried numerous different ways- even using UPDATE instead of INSERT but had no luck. Help? Link to comment https://forums.phpfreaks.com/topic/46156-select-last-entry/ Share on other sites More sharing options...
AndyB Posted April 8, 2007 Share Posted April 8, 2007 Typically for your query to select the most recent the SQL syntax is along the lines SELECT * from database_tablename ORDER by id DESC LIMIT 1 Link to comment https://forums.phpfreaks.com/topic/46156-select-last-entry/#findComment-224352 Share on other sites More sharing options...
fenway Posted April 8, 2007 Share Posted April 8, 2007 Or last_insert_id if it really is an insert. Link to comment https://forums.phpfreaks.com/topic/46156-select-last-entry/#findComment-224438 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.