seany123 Posted September 10, 2011 Share Posted September 10, 2011 im trying to return the highest value in my table from the season_id column this is the code i have: $test = mysql_query("SELECT * FROM `$show` WHERE [season_id]=(SELECT Max([season_id]) FROM `$show`)"); please advise? Quote Link to comment https://forums.phpfreaks.com/topic/246867-why-isnt-this-working-max-function/ Share on other sites More sharing options...
Pikachu2000 Posted September 10, 2011 Share Posted September 10, 2011 What errors are returned by mysql_error()? Quote Link to comment https://forums.phpfreaks.com/topic/246867-why-isnt-this-working-max-function/#findComment-1267828 Share on other sites More sharing options...
seany123 Posted September 10, 2011 Author Share Posted September 10, 2011 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '[season_id]=(SELECT Max([season_id]) FROM `24`)' at line 1 Quote Link to comment https://forums.phpfreaks.com/topic/246867-why-isnt-this-working-max-function/#findComment-1267831 Share on other sites More sharing options...
Pikachu2000 Posted September 10, 2011 Share Posted September 10, 2011 Why do you have the square brackets in the query string? Quote Link to comment https://forums.phpfreaks.com/topic/246867-why-isnt-this-working-max-function/#findComment-1267838 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.