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? Quote 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 Quote 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. Quote Link to comment https://forums.phpfreaks.com/topic/46156-select-last-entry/#findComment-224438 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.