Jump to content
MakeWebGames

Gym Error


MNG

Recommended Posts

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;
}
Link to comment
Share on other sites

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 by KyleMassacre
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...