on 12-18-2009 5:33 AM
Operating system: CentOS 5.3 Final
PHP: 5.2.10
Apache: 1.3.41
MaxDB: 7.7 Linux 32 Bit
PHP MaxDb Extension: 7.6.00.38
Hi!
I have a table with a float field. But when I'm trying to select it via php, I'm getting an integer.
if($result = maxdb_query ($p_db, "select height from office_rent where id=75787")) {
if($row = maxdb_fetch_row ($result))
$height = $row[0];
maxdb_free_result ($result);
}
print_r($row);
The result is Array ( [0] => 3 ) although the "height " field contains 3.3.
May be it's some php.ini setting issue? Where am I wrong?
Thanks in advance,
Alex.
Edited by: Alex Petrov on Dec 18, 2009 6:33 AM
>
> Operating system: CentOS 5.3 Final
> PHP: 5.2.10
> Apache: 1.3.41
> MaxDB: 7.7 Linux 32 Bit
> PHP MaxDb Extension: 7.6.00.38
>
> Hi!
> I have a table with a float field. But when I'm trying to select it via php, I'm getting an integer.
>
>
if($result = maxdb_query ($p_db, "select height from office_rent where id=75787")) {
> if($row = maxdb_fetch_row ($result))
> $height = $row[0];
>
> maxdb_free_result ($result);
> }
> print_r($row);
>
> The result is Array ( [0] => 3 ) although the "height " field contains 3.3.
> May be it's some php.ini setting issue? Where am I wrong?
Hi Alex,
Unfortunately I don't have an idea what is wrong in your case. But what I know is that I also found bugs in the php maxdb extension and it may well be that you have found a bug too. Maybe it's just a question of different types of float, maybe the types you use does not map between maxdb and php. Just a wild guess because I'm far from being en expert on this.
I have put the patches I'm using in my rpms here [PHP MaxDB patches|http://www.invoca.ch/pub/packages/maxdb/] they are from the bugtracker at pecl.php.net and maxdb-7.6.00.38-php_assoc.patch is the one I created after I found a bug.
I don't really think one of those patches will help in your case but you may want to try it anyways.
BTW, the link will only be valid today.
Regards,
Simon
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
var_dump shows
array(1) { [0]=> float(3) }
and the "height" field is definitely float. Here is a screenshot from SQL Studio:
Link: [http://img15.imageshack.us/img15/1626/testro.jpg]
Same thing with other float fields - they just became integers in php
Edited by: Alex Petrov on Jan 11, 2010 12:23 PM
Hm, that's interesting. I see that you use CentOS 5.3 but your apache and PHP are not the ones delivered with the OS.
Using CentOS 5.4 with it's php-5.1.6 I have just tried this and float values are fetched as float in my PHP.
for example I see
[3]=> float(7.3523502)
I have no idea why this doesn't work in your environment.
User | Count |
---|---|
87 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.