Hi everyone,
I've recently begun learning PHP and it looks like I took on too much so soon.
I'm attempting to fix a php script that detects whether or not a person is Eligible to join a tournament or not when they register and attempt to join. I'm doing it locally at the moment so i don't need to upload every 5 minutes. Any assistance would be appreciated.
On register.php, I am receiving the following error:
- Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/vehement/public_html/ladder/join.php on line 935
Here is the code for joining the tournament:
- function check_if_ladder_under_usergroup($ladderid, $teamid=NULL, $userid=NULL){
-
global $config;
-
-
$sql = mysql_query("SELECT * FROM groupstable WHERE `ladderon` = ".$ladderid);
-
if(mysql_num_rows($sql) > 0){
-
//ladder is restricted
-
if(empty($teamid) && empty($userid)) return false; //return that is ladder is restricted
-
-
$ginfo = mysql_fetch_assoc($sql);
-
if(mysql_num_rows(mysql_query("SELECT * FROM groupsmembers WHERE `groupid` = ".$ginfo['id']." AND `memberid`=".intval($userid)."")) > 0){
-
return true;
-
}elseif(empty($teamid)){
-
return false;
-
}else{
-
return (mysql_num_rows(mysql_query("SELECT * FROM groupsmembers WHERE `groupid` = ".$ginfo['id']." AND `teamid`=".intval($teamid)."")) > 0);
-
}
-
}
-
return true; //no restirction
-
}
On the "if(mysql_num_rows($sql) > 0)" part, I don't understand why it's not a valid argument. Thanks for any advise you can provide!