Jump to content

Bit of re-ordering


doddsey_65

Recommended Posts

I have a query which pulls profile posts. This query sorts them via the date they were posted DESC. So newest ones are on top. However is a post has a comment i display the comment under the post. but the comments under the post are all ordered by DESC since it is one query to pull all of them. How would I order the comments in the reverse?

 

$sql = "SELECT f.*, u.u_uid, u.u_group_color, u.u_avatar
            FROM ".TBL_PREFIX."wall_feeds f
            JOIN ".TBL_PREFIX."users u
            ON (f.f_poster = u.u_username)
            WHERE f_uid = '$uid'
            AND f_pid = '$parent'
            ORDER BY f_time_posted DESC";

 

Link to comment
https://forums.phpfreaks.com/topic/244293-bit-of-re-ordering/
Share on other sites

It is not clear from your query where the comments are stored - or even if they are included in that query. I would think that the comments would be stored in a separate table with a reference back to the post. Are the posts and comments all stored in the wall_feeds table? If so, please provide the structure.

Link to comment
https://forums.phpfreaks.com/topic/244293-bit-of-re-ordering/#findComment-1254729
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.