Message-ID: <[EMAIL PROTECTED]>
Date: Tue, 19 Jul 2005 15:16:47 -0400
From: blackwater dev <[EMAIL PROTECTED]>
Reply-To: blackwater dev <[EMAIL PROTECTED]>
To: php-db@lists.php.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Subject: floats

I am running a query on MySQL:

select * from cars where id =52

It returns the row and I can see that gas mileage is saved as a float
with a value of 23.45.  So I then do a query, select * from cars where
id=52 and gas_mil=23.45 and the query doesn't retun anything.  Why?
Do I have to cast this as a float?

Although it's possible that the float has a value of 23.4500000000000001, I wouldn't expect that to be an issue.

Instead, check that your gas_mil name is *exactly* that and not followed by a space (I've done it before !)
For example this        SELECT * FROM cars WHERE `gas_mil` = 23.45
is NOT equivalent to    SELECT * FROM cars WHERE `gas_mil ` = 23.45
Notice the extra space in the column name.

If that doesn't work do a query for
SELECT * FROM cars WHERE id=52 AND gas_mil BETWEEN 23.4 AND 23.5

See what happens then,
Cheers - Neil

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to