Jump to content

ORDER by acting strange


drstop

Recommended Posts

Hi,

I know its something really simple, but after 2 days of searching around I finally decided to give up... here is the issue:

  • I have a mysql table with topics and the number of time they have been read
  • the "number of reads" is called READS and is INT(11)
  • I <b>CAN</b>order ascending/descending when I do it in phpmysql, no problems
  • in PHP, running a simple query like SELECT * FROM stories ORDER BY 'reads' DESC" produces zero rows :'(
  • All other fields ORDER BY without problems
  • the field has ONLY numbers

I am getting kinda crazy here... any possible hints as to where the problem can be? Will GLADLY describe anything that might help you help me :)

With best regards

Alexander

 

Link to comment
Share on other sites

backticks actually helped!!!!!!!!!!!!!!!!!!!!!!

Interesting that no quotes (backticks) still doesnt produce any result.

In the same table, have a field called ID (exactly same thing, INT(11))

SELECT* FROM stories ORDER BY id  <--- works perfectly

SELECT* FROM stories ORDER BY reads <---- doesnt work

 

But backticks solved it!!

Thanks ALOT for your help!

 

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.