I have a local-only project which I’m working on where I have a table with id, title and price fields.
Example info:
ID || Title || Price
1 - Title 1 - 8.00
2 - Title 2 - 75.00
3 - Title 3 - 70.00
When I try to ORDER BY price it comes back like this:
8.00
75.00
70.00
Statement:
$query = mysql_query("Select * From table ORDER BY price DESC");
What am I doing wrong?
Your
pricecolumn must have a characterCHAR() or VARCHAR()type rather than a numeric type. Cast it as aDECIMALin theORDER BY:The real fix for this would be to change the
pricedata type to a proper numeric type.