Re: Converting to integer
| From: | Richard Davey | Date: | Tue, 16 Nov 2004 13:09:15 +0000 |
| Subject: | Re: Converting to integer | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-202132@lists.php.net to get a copy of this message | ||
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