[FX.php List] Problem storing floats in MySQL table

Gjermund Gusland Thorsen ggt667 at gmail.com
Sat Mar 15 10:10:38 MDT 2008


Perhaps floatval is better in your case?

http://www.php.net/manual/en/function.floatval.php

ggt

2008/3/14, Wouter Moerdijk <wouter.moerdijk at gmail.com>:
> Hi,
>
> I using FX to access both a FM and a MySQL DB. I am trying to store some
> data in a MySQL table. All is fine as long as the MySQL table only has
> varchar or text fields. The problem I am running into happens when I try to
> use fields of numeric types like float, double, integer etc. As soon as I
> post an empty field of these type FX throws an error. I have a quick fix
> where I alway add a "0" to the number,
>
> e.g.
> $db->AddDBParam('nr',$_REQUEST['nr']+0);
>
> But off course this will store a "0" in stead of a NULL in the db. How do I
> handle this?
>
> W.
> --
> <img src="http://gsig.brightdev.com/3/Wouter.Moerdijk.png">
> _______________________________________________
>  FX.php_List mailing list
>  FX.php_List at mail.iviking.org
>  http://www.iviking.org/mailman/listinfo/fx.php_list
>
>


More information about the FX.php_List mailing list