You have a few ways to do this.
What's happening here is that you do a comparison in a string context,
which means that it will sort according to the ascii values, and 1 comes
before 8.
To sort the way you want you need to specify to MySQL that you want to do
it in a numeric context.
You have two simple ways to do this.

Add 0 to the string number to force it into numeric mode.

AND squarefeet >= '$squarefeet' + 0

use the CAST() function, it's described more at:
http://www.mysql.com/doc/en/Cast_Functions.html


On Mon, 8 Dec 2003, Ed Curtis wrote:

>
> I've got an entry in a table where the value is 875. If I run a query on
> that table with the clause AND sqaurefeet >= '$squarefeet' and $squarefeet
> has a value of say 1000 the row with the squarefeer value of 875 will
> appear. The column is of type varchar(10) and using the binary flag.
>
> What am I doing wrong?
>
> Thanks,
>
> Ed
>
>
>
>

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to