Sign in to follow this  

[web] Php ordering, help.

This topic is 3304 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
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

This topic is 3304 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this