Jump to content

I might just be stupid - php/mysql problem. please/thx in advance


Recommended Posts

ie says error on line 44. here are the lines surrounding line 44. (it was working before, and just stopped.  no changes to the script, only changes to database was more entries added.

$totalteams=mysql_query("SELECT COUNT(*) FROM ladder_$id ");
$totalteams=mysql_fetch_array($totalteams);
$totalteams="$totalteams[0]";

 

here is my whole code:

 

<?

include("./includes/incglobal.php");

global $config;

$groups=mysql_query("SELECT id,name,logo,active,priority,created FROM groups WHERE active='1' ORDER BY priority");
while(list($gid,$gname,$glogo,$gactive,$gpriority,$gcreated)=mysql_fetch_row($groups)){

$totalla=mysql_query("SELECT COUNT(*) FROM ladders WHERE grid='$gid' ORDER BY id");
$totalla=mysql_fetch_array($totalla);
$totalla="$totalla[0]";

if(!$glogo){
$headlogo="";
}else{
$headlogo="<img src='$glogo' border='0'><br />";
}

$out[body].="<center><br />$headlogo
                <table width='96%' cellpadding='1' cellspacing='1' bgcolor='#000000' border='0'>
                 <tr>
                  <td width='37%' style='background: url($config[bg]) repeat-x;' colspan='7'><b>$gname</b></td>
                 </tr>
                 <tr>
                  <td width='37%' style='background: url($config[bg2]) repeat-x;'> Ladder</td>
                  <td width='30%' style='background: url($config[bg2]) repeat-x;'> Game</td>
                  <td width='8%' style='background: url($config[bg2]) repeat-x;'>Join</td>
                  <td width='8%' style='background: url($config[bg2]) repeat-x;'>Rules</td>
                  <td width='10%' style='background: url($config[bg2]) repeat-x;'>Matches</td>
                  <td width='12%' style='background: url($config[bg2]) repeat-x;'>Count</td>
                  <td width='3%' style='background: url($config[bg2]) repeat-x;'></td>
                 </tr>";

if($totalla == 0){
$out[body].="
<tr bgcolor='$config[altcolora]'><td width='100%' background='$config[cellbg]' colspan='7'> There are currently no ladders in this group</td></tr>";
}

$ladders=mysql_query("SELECT id,name,game,gamelink,grid,isteam,active FROM ladders WHERE grid='$gid' ORDER BY id");
while(list($id,$name,$game,$gamelink,$grid,$isteam,$active)=mysql_fetch_row($ladders)){

$totalteams=mysql_query("SELECT COUNT(*) FROM ladder_$id ");
$totalteams=mysql_fetch_array($totalteams);
$totalteams="$totalteams[0]";

if ($active == 0) {
$light = "<img src='./images/ineligible.png' border='0' alt='Ladder is inactive!'>";
$link = "$name";
}else{
$light = "<img src='./images/eligible.png' border='0' alt'Ladder is active!'>";
$link = "<a href='$config[scripturl]/standings.php?ladder[id]=$id' class='content'>$name</a>";
}

if($gamelink){
$glink="<a href='$gamelink'>$game</a>";
}else{
$glink="$game";
}

if($config[altcolorx]==$config[altcolora]){
$config[altcolorx]="$config[altcolorb]";
}else{
$config[altcolorx]="$config[altcolora]";
}
if($config[cellbgx]==$config[cellbg]){$config[cellbgx]="$config[cellbg2]";}else{$config[cellbgx]="$config[cellbg]";}

$out[body].="
<tr bgcolor='$config[altcolorx]'>
     <td width='30%' background='$config[cellbgx]'> $link </td>
     <td width='30%' background='$config[cellbgx]'> $glink</td>
     <td width='8%' background='$config[cellbgx]'><a href='./join.php?ladder=$id'>Join!</a></td>
     <td width='8%' background='$config[cellbgx]'><a href='./rules.php?rules[ladderid]=$id'>Rules</a></td>
     <td width='10%' background='$config[cellbgx]'><a href='./matchdb.php?ladder=$id'>All Match</a></td>
     <td width='12%' background='$config[cellbgx]'>$totalteams</td>
     <td width='3%' background='$config[cellbgx]'>$light</td>
     </tr>";
}
$out[body].="</table></center>";
}
$out[body].="<br /><br />";

include("$config[html]");



?>

 

here is the error im recieving:

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mash905/public_html/betting/ladders.php on line 44

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/mash905/public_html/betting/ladders.php on line 44

For anyone helping on this topic, it is double posted.

 

http://www.phpfreaks.com/forums/index.php/topic,240254.0.html

 

Please use that one as it contains more updated information than this thread. Just an FYI.

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.