Page 1 of 1

Sorting Tables DESC

Posted: Thu Jun 26, 2003 12:17 pm
by DuFF
Alright,
I have a mysql table and one of the columns is named rating. Right now I'm trying to sort the contents of my database according to the rating. Here is my query:

Code: Select all

<?php
$query="SELECT * FROM files WHERE category='$category' ORDER BY '$order'";
?>
I have a link that has the following value:

Code: Select all

&lt;a href='$PHP_SELF?category=$category&amp;order=rating'&gt;Rating:&lt;/a&gt;
The link works fine except that it sorts the rating from least to greatest. I tried adding DESC and ASC but nothing worked, the rating is always least to greatest. Does anyone know why?
BTW, the rating type is:
decimal(2,1)

Posted: Thu Jun 26, 2003 12:52 pm
by m@ndio
sorry did u say you tried this:

Code: Select all

<?php 
$query="SELECT * FROM files WHERE category='$category' ORDER BY '$order' DESC"; 
?>