Comparison with formatted numbers

From: Date: Tue, 30 Jul 2002 18:15:35 +0000
Subject: Comparison with formatted numbers
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-20904@lists.php.net to get a copy of this message
I've run into a sticky case where my query is failing (PHP4.x/MySQL). I have a table where the price value is imported from an external source, so I can't change it on the fly, and they embed thousands seperators (in my case ','). When I try to do a query such as ".. where price <= '250000' .." if finds values that meet or exceed that value (returns some in the range of 2,500,000. I gather that it is failing because of the comma (the price field contains values of '2,500,000'). Is there a function that I can use to force the price format to integer before/during the query? Or would it work if I did a number_format on the test value? ie: '.. where price <= '200,000' ..' Help would be appreciated. Terry

« previous php.db (#20904) next »