maxudaskin Posted January 30, 2008 Share Posted January 30, 2008 <?php $result = mysql_query("select * from users ORDER BY pid"); while($row = mysql_fetch_array($result)) {if($colourbare == 1){ echo ''; $colour = '#F2F2F2'; }else{ $colour = '#E2E2E2'; echo ''; } echo "<tr>"; echo "<td bgcolor='". $colour ."'><a href='../user.php?pid=" . $row['pid'] . "' class='ab'>" . $row['fname'] . "</td>"; echo "<td bgcolor='". $colour ."'><a href='../user.php?pid=" . $row['pid'] . "' class='ab'>" . $row['lname'] . "</td>"; echo "<td bgcolor='". $colour ."'><a href='../user.php?pid=" . $row['pid'] . "' class='ab'>" . $row['pid'] . "</td>"; echo "<td bgcolor='". $colour ."'><a href='../user.php?pid=" . $row['pid'] . "' class='ab'>" . $row['hub'] . "</td>"; echo "<td bgcolor='". $colour ."'><a href='../user.php?pid=" . $row['pid'] . "' class='ab'>" . $row['country'] . "</td>"; echo "<td bgcolor='". $colour ."'><a href='../user.php?pid=" . $row['pid'] . "' class='ab'>" . $row['position'] . "</td>"; $pid = $row['pid']; $hours_sql = mysql_query("SELECT SUM(totaltime) as sumValue FROM pireps WHERE pid = {'$pid'} GROUP BY pid ORDER BY sumValue DESC LIMIT 5"); while($hours = mysql_fetch_array($hours_sql)){ // Line 353 - - - - - - - - - - - - - - - - - - echo "<td bgcolor='". $colour ."'><a href='../user.php?pid=" . $row['pid'] . "' class='ab'>" . $hours['sumValue'] . "</td>"; } echo "</tr>"; ?> I get the error: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/.grable/vzoom/virtualzoom.net/info/roster.php on line 353 Quote Link to comment https://forums.phpfreaks.com/topic/88503-solved-now-i-am-confused/ Share on other sites More sharing options...
trq Posted January 30, 2008 Share Posted January 30, 2008 You attempt to use the result of a query without first checking it worked. More than likely your query is failing. mysql_query("SELECT SUM(totaltime) as sumValue FROM pireps WHERE pid = '$pid' GROUP BY pid ORDER BY sumValue DESC LIMIT 5"); Quote Link to comment https://forums.phpfreaks.com/topic/88503-solved-now-i-am-confused/#findComment-453051 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.