MNG Posted July 9, 2015 Share Posted July 9, 2015 I have been looking through the globals,gym a few other files and I realize the global func might be the problem. Here's the error I keep getting QUERY ERROR: 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 '373 AND us.userid != 1 AND u.user_level != 0' at line 1 Query was SELECT count(*) FROM userstats us LEFT JOIN users u ON us.userid=u.userid WHERE us.strength > 2,373 AND us.userid != 1 AND u.user_level != 0 Here's the little piece of the globals function get_rank($stat, $mykey) { global $db; global $ir,$userid,$c; $q=$db->query("SELECT count(*) FROM userstats us LEFT JOIN users u ON us.userid=u.userid WHERE us.$mykey > $stat AND us.userid != $userid AND u.user_level != 0") ; return $db->fetch_single($q)+1; } Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted July 9, 2015 Share Posted July 9, 2015 (edited) What is your usage of the function? The $stat param would be the key=>value pair and the $mykey param would be a string of the stat name you are querying. For example: $strength = get_rank($ir['strength'],'strength'); Or you can do it this way: $stats = array( 'strength','guard','agility' ); foreach($stats as $stat) { echo ucfirst($stat) .": ". get_rank($ir[$stat],$stat); } And that should work Since an integer value is being passed in your error it looks like to me you are passing a key=>value pair in the 2nd parameter, basically saying you don't have a column named 373 in userstats Edited July 9, 2015 by KyleMassacre Quote Link to comment 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.