|
Posted by Henk verhoeven on 04/12/07 22:54
Hi david,
Maybe you could use CONV(`columnname`, 10, 10) in your SQL to convert
the integer to a string before it is passed to php.
for example if the colum holding 64 bits integers is named `theInt`:
SELECT id, CONV(theInt, 10, 10) FROM yourtable
would return the id and theInt columns but theInt converted to a string.
Once the string is in php you may use GMP functions for calculations
etc., see http://nl2.php.net/manual/en/ref.gmp.php
Success,
Henk Verhoeven,
www.phppeanuts.org.
David T. Ashley schreef:
> I have a box where I'm forced to use PHP before 64-bit integers became
> standard ...
>
> If I run a MySQL query where one of the fields returned is 64-bit integer,
> how do I get this into PHP as a string? My recollection is that in the
> result sets it "auto types" so that it is an integer, and 64-bit integers
> will cause problems if one tries to assign into 32 bits.
>
> P.S.--Once into PHP as a string, I would use the bcmath library to
> manipulate it ...
Navigation:
[Reply to this message]
|