Re: Converting to integer

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

 



Hello Octavian,

Tuesday, November 16, 2004, 12:53:24 PM, you wrote:

OR> I have tried using the function is_numeric to test which of the values
OR> returned from MySQL are numbers, but none of them appear to be a number, so
OR> I cannot convert them.

Because, unless you cast it otherwise, MySQL always returns strings.

You can use either:

$num = intval($mysql_num);

or just cast it:

$num = (int) $mysql_num;

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I am not young enough to know everything." - Oscar Wilde

-- 
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