Re: Problems with strings being handled like numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



J B wrote:
I've been playing with it and it looks like mssql_fetch_row may be the problem. Right after this line:

$line = mssql_fetch_row($result);

 ...I inserted this line:

var_dump($line[0]);

...and this is what I got back:

string(20) "3.67124100206018e+17"

The actual contents of that cell should be "367124100206018209". So it looks like the contents of the cell have already been mangled before they're even assigned to the array variables (which would explain why my previous attempts at typecasting at assignment time weren't having any effect...it was already a string). Is there some way I can tell mssql_fetch_row() to leave the contents alone?

By the way, if I do "SELECT cast(Number as char) from Voucher..." and leave the rest of it the same, I do get the whole number...but that seems kinda inelegant. Is this expected behaviour for mssql_fetch_row()?


What datatype is Number in the database? The behaviour you're getting is by design if it is any number type; for the behaviour you expect you will need to change it to a string type or do the cast as you detailed.

--
Jasper Bryant-Greene
Freelance web developer
http://jasper.bryant-greene.name/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux