PHP & mySQL... Why doesn't SELECT MAX work?

  • Thread starter Thread starter egobuilders
  • Start date Start date
E

egobuilders

Guest
I have successfully connected to the database and confirmed it, however, this returns a zero, even though myfield contains a 7... I have tried with and without apostrophes, etc... I also added AS myfield after MAX(myfield), but it still returns 0. Sometimes it even returns a 5, which has absolutely no relation to anything... there are not 5 instances of anything!

$result = mysql_query("SELECT MAX(myfield) FROM stats"); // does not work

$result = mysql_query("SELECT MAX('myfield') FROM 'stats'"); // does not work

$result = mysql_query("SELECT MAX(myfield) AS myfield FROM stats"); // does not work

No combination of these works. Help!!!
The data type is int(50) ...50 should be plenty ;)
 
What is the data type of my field, based on the information you're provided that's the only problem I can think of.

If it's not a numeric data type that could be the problem.
 
What is the data type of my field, based on the information you're provided that's the only problem I can think of.

If it's not a numeric data type that could be the problem.
 
What is the data type of my field, based on the information you're provided that's the only problem I can think of.

If it's not a numeric data type that could be the problem.
 
Back
Top