robotman321 Posted January 22, 2008 Share Posted January 22, 2008 Ok i have this LIMIT function that is not working to my liking, i am running 4.1.22-standard, and this is the statement: SELECT id, newstitle, newsdate, newscontent FROM news ORDER BY id DESC LIMIT 6 Now i want it to display the latest 6, now it starts to display the first 5 of the 6, I put a more current "news Item" into the DAtabase but it doesnt show. Say there are 6 items the 6th item being the Newest and it wont display that id#6. I don't know why it just wont display... you can see it here where it only shows the first 4 when the 5th is in the system it just won't show. http://rs-serenity.com/homepage.php Thank-you for all help `Robot Quote Link to comment https://forums.phpfreaks.com/topic/87244-solved-need-help-with-the-limit-statment/ Share on other sites More sharing options...
revraz Posted January 22, 2008 Share Posted January 22, 2008 You should order by newsdate and not by ID. Also, use LIMIT 0,6 Quote Link to comment https://forums.phpfreaks.com/topic/87244-solved-need-help-with-the-limit-statment/#findComment-446267 Share on other sites More sharing options...
robotman321 Posted January 22, 2008 Author Share Posted January 22, 2008 ok i did that, but i put a new news article in and it still doesn't show up =/ It like its got a hold back of 1, on the above link, there should be another article on top of it =/ Quote Link to comment https://forums.phpfreaks.com/topic/87244-solved-need-help-with-the-limit-statment/#findComment-446270 Share on other sites More sharing options...
beebum Posted January 22, 2008 Share Posted January 22, 2008 You may want to work at the MySQL command line for a bit to verify if it's the SQL or the PHP. First verify that the data is as you expect it to be, then verify your query syntax at the command line, then when that's working, check your PHP code. Quote Link to comment https://forums.phpfreaks.com/topic/87244-solved-need-help-with-the-limit-statment/#findComment-446285 Share on other sites More sharing options...
robotman321 Posted January 22, 2008 Author Share Posted January 22, 2008 ok, i will try that, thanks. Quote Link to comment https://forums.phpfreaks.com/topic/87244-solved-need-help-with-the-limit-statment/#findComment-446301 Share on other sites More sharing options...
robotman321 Posted January 22, 2008 Author Share Posted January 22, 2008 lol i just realized, i was taking the idea from a paging system and it didnt include the following paging, i commented it out so its all good now xD sorry so my bad Quote Link to comment https://forums.phpfreaks.com/topic/87244-solved-need-help-with-the-limit-statment/#findComment-446310 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.