Jump to content

What is wrong with my query?


refiking

Recommended Posts

I am trying to sort the results by (added) which is a timestamp, but it isn't sorting them by the timestamp.  Some of the most recent entries (which should appear at the top) or going down to the middle.  Here is the query:

$sql = mysql_query("select * from records where `read` < 1 order by added");

Link to comment
https://forums.phpfreaks.com/topic/196629-what-is-wrong-with-my-query/
Share on other sites

The default ORDER BY by is ASC. If the column is a mysql TIMESTAMP data type, what you are doing will work.

 

What is the column definition and how did you produced and enter the values?

 

Also, what is your code that is retrieving and displaying the results?

 

Short-answer: There's nothing wrong with the method you are using and it should work, assuming the column, the data, and your code is what you are implying.

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.