|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
|
|
#1
|
|||
|
|||
|
problem in retrieving float from MySQL
Hi everybody,
I am facing problem querying MySQL tables with PHP. Actually I have a field in a table with float data type. In one record i've value 2.95 in the float field. When I retrieve and print it from PHP code, it prints 2.9500000476837. I know it's 'coz data type is float and there are few precision issue involved. But when i run the following query from PHP ==> "SELECT * FROM url_keywords WHERE bid = 2.95" or "SELECT * FROM url_keywords WHERE bid = 2.9500000476837" I get nothing in both case. Please help me. Waiting for ur response. Regards Ashish |
|
#2
|
|||
|
|||
|
RE: problem in retrieving float from MySQL
That's a common problem with floating points..you are right on that...to fix it, try a query like:
select * from url_keywords where abs(bid - 2.95) < .001 |
|
#3
|
|||
|
|||
|
Thanks Matt
Hi Matt,
Thanks alot for solving my problem. Your solution works fine. once agian thanks alot. Regards Ashish |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > problem in retrieving float from MySQL |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
![]() |
|