Jump to content
  • Advertisement
Sign in to follow this  
gamerking

[web] Php ordering, help.

This topic is 3615 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey I have a question which I couldn't think up an answer for myself; and am coming to see if I can grab a tip or two. Here my problem: I have a food etc. comments list which people need to fill out, the catergory with the newest review raises to the top of the page, and here in lies my problem. I don't know how to get that simple ordering process going. SELECT * FROM items WHERE type='c' ORDER BY datelisted. This returns all comments. But I can't figure out how to orginize it. You see I need it to go type->preview of results (shows 4 latest comments). Start again until it hits the page limit. my problem is how do I know which item is at the start I have type set as either c or i which is item or comment so how do I get it to grab the item then grab the two newest comments while keeping it all from newest to oldest? Thanks for the help, please feel free to ask if you need anymore information. So lets say: Apple gets 8 new comments in the last minute (last 2mins ago) bannana gets 1 in the last 5(last 4mins ago) and orange gets 4 in the last 15 (last 8minutes ago) How can I get it to go: apple Comment newest Second newest banna comment newest Second newest orange comment newest second newest.

Share this post


Link to post
Share on other sites
Advertisement
Thanks but don't worry rather than looking for some mythical command I 'll just add a last post field into the database.

Thanks anyway :)

Share this post


Link to post
Share on other sites
You might try something like:

SELECT *
FROM Items
ORDER BY item_type, datelisted DESC

This would get you your result set, then just print the item name and other information as you normally would.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!