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
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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.