note 7562 deleted from max by jeroen
| From: | jeroen@php.net | Date: | Wed, 15 Aug 2001 22:24:01 +0000 |
| Subject: | note 7562 deleted from max by jeroen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-16784@lists.php.net to get a copy of this message | ||
Fetching values from a mysql database returns strings, whether a field is numeric or not. When
sending the fetched values to max() they will be compared as if they were strings:
max ('2','8','50')
is 8.
To compare numbers, cast the values to integer: max((int)'2', (int)'8',
(int)'50).