Re: Problems with strings being handled like numbers
| From: | J B | Date: | Thu, 15 Sep 2005 18:26:54 +0000 |
| Subject: | Re: Problems with strings being handled like numbers | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222488@lists.php.net to get a copy of this message | ||
On 9/14/05, Richard Lynch <ceo@l-i-e.com> wrote:
> mssql_* and PHP "know" that the data is supposed to be "integer"
>
> But the largest integer that PHP can store is 0xFFFFFFFF.
>
> So when PHP tries to accept the "integer" from mssql_fetch_row, it's
> got no room to store it as integer, and HAS to convert it to float.
Ah, OK. I was beginning to suspect it might be that; thanks for confirming.
If you JUST want to display it, and not manipulate it in PHP, you can
> ignore that bit about BC_MATH and the other extension.
Yes, these serial numbers have no mathematical significance. In fact, I'm
not even sure why they're stored as numbers in the database at all...maybe
for performance reasons, my database design knowledge is still pretty
minimal so I can't comment on that (I didn't create the database).
You'll need to use the typecast to char in MSSQL no matter what, cuz
> ain't no way PHP is gonna store an integer bigger than 0xFFFFFFFF as
> an integer.
>
OK...knowing that, doing the typecast in the SQL query doesn't seem
inelegant any more. Thanks for the info!