Mysql and Numbers
Posted: Wed Sep 07, 2005 1:18 am
I have this query:
priority is a number. It can be any number (1, 1.1, 100, 2000.50 etc etc) and it needs to allow me to add dots in the numbers.
When I have priority set to something like INT(10) in phpMyAdmin, it doesn't allow dots. I then changed it to VARCHAR to see if it would allow dots and it did.
However, it did not order the numbers correctly. Instead of ordering it the correct way which is:
1, 50, 100, 200
It ordered incorrectly:
1, 100, 200, 50
How can I make it allow dots but also order correctly?
Code: Select all
$query = mysql_query("select * from {$tbl_name}products_items where cat='$cat' order by priority asc");When I have priority set to something like INT(10) in phpMyAdmin, it doesn't allow dots. I then changed it to VARCHAR to see if it would allow dots and it did.
However, it did not order the numbers correctly. Instead of ordering it the correct way which is:
1, 50, 100, 200
It ordered incorrectly:
1, 100, 200, 50
How can I make it allow dots but also order correctly?