Jump to content

Ordering replies


phpfan101

Recommended Posts

I am trying to make a commenting system...

all is working well but one thing, when a new comment is made, it is automatically at the top of all comments, i want it to read like a forum, oldest first, newest comment last...

 

i !DO! use a unix timestamp to store the time the post is made in my mysql db, i just dont know how to efficiently use it to get my desired outcome, anyone?

Link to comment
https://forums.phpfreaks.com/topic/185295-ordering-replies/
Share on other sites

If you're using MySQL, I guess this isn't the right place. But basically, ordering in MySQL works like this:

 

SELECT `field1`, `field2` FROM `table` ORDER BY `field3` ASC

 

Where field3 is the field you want to order by (duh), which would be the timestamp in your case. Also, ASC can be replaced with DESC to get the newest first.

Link to comment
https://forums.phpfreaks.com/topic/185295-ordering-replies/#findComment-978154
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.