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
https://forums.phpfreaks.com/topic/199715-order-by-acting-strange/
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!

 

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.