Forum Moderators: coopster

Message Too Old, No Replies

Mysql Order By

         

adamnichols45

6:25 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Problem i am having is as follows

$sql = mysql_query("SELECT make, model, price FROM cars WHERE countie ='$countie' AND make ='$carrymake' AND model ='$carrymodal' ORDER BY price LIMIT $from, $max_results");

this outputs

19560
3
4000
4000
958

SO it look like its taking the first number from every line and outputting it that way

BUT i want it to take in to account all the number in the line so it outputs

3
958
4000
4000
19560

Any one know how i would modify my ORDER BY clause please.

rover

6:34 pm on Jan 26, 2005 (gmt 0)

10+ Year Member



I'm no SQL expert, but I think you need to make sure that your 'price' field data type is a numeric type like INT (and not a string type like CHAR or TEXT). Then it should sort the way you want.

adamnichols45

6:39 pm on Jan 26, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Well you should be an expert

THANKS SO MUCH Rover thats spot on!

Cheers