Order by price, PHP MYSQL output issues

93jordanaj used Ask the Experts™
I am trying to output from a MYSQL database using PHP ordered by price. Everything works, however the results are ordered by the first digit:


The code I used is pretty straight forward and shown below, but how do I make it actually order by price and not the first digit?
$printing = mysql_query("SELECT * FROM products WHERE listed='1' ORDER BY price") or die(mysql_error());

Open in new window

Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
what is the data type of the field "price"?


'Varchar', should I change it to 'int'?


I just changed it - problem solved. Thanks for making me double check.


Thanks for making me double-check. Solved it by myself, but probably wouldn't have looked there without you.
Is the pound (£) sign saved in the db as well? If it is you could try

$printing = mysql_query("SELECT * FROM products WHERE listed='1' ORDER BY price + 0") or die(mysql_error());

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial