Problem with Max() function

wxdqz

New Member
Hi,

I'm having some trouble with MySQL's max() function inside php. The results I'm getting in the MySQL shell are much diffrent from the results I'm getting in PHP.

For example,

mysql_connect ($database[host], $database[user], $database[password]);
mysql_select_db ($database[database]);
$testing = mysql_query("SELECT MAX(id) FROM sampledatabase");

produces 2. Now if I run this command inside the MySQL shell as -

SELECT MAX(id) FROM sampledatabase;

it produces 5, which is the right number of records. I've looked in a few books ( mostly inside mSQL and MySQL by O'reilly ) and I haven't found anything about this. Any idea what's going on, or am I just doing something really basic wrong.

Thanks,

-Alex Augot
Teradyne, Inc
 
Back
Top