Jump to content

Recommended Posts

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in tops.php on line 33

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in tops.php on line 56

 

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in tops.php on line 76

 

 

i have point the lines out in red

this is tops coding

 

 

<?

session_start();

include "includes/functions.php";

logincheck();

$username=$_SESSION['username'];

include "includes/db_connect.php";

echo "$style";

 

?>

 

 

 

 

<center><html><head>

<title>Untitled Document</title>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

 

<body>

<table width="100%" border="0" cellspacing="4" cellpadding="2">

  <tr>

    <td width="274" height="122" valign="top"><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="<?php echo "$td_border"; ?>" bgcolor="#666666">

        <tr>

          <td height="22" colspan="2" background="includes/grad.jpg"><center class="TableHeading">

              <font color="#FFFFFF">Top 10 Ranks </center></td>

        </tr>

        <tr>

          <td width="127" height="10" valign="top"><b>Username</b></td>

          <td width="136" valign="top"><b>Rank</b></td>

        </tr>

        <center><?php

$tsel = mysql_query("select * from `users` where `userlevel`='0' and `status`='alive' order by `rank` desc limit 10");

while ($top=mysql_fetch_array($tsel)) { line 36

print "<tr><td></center><a href=profile.php?viewuser=$top[username]>$top[username]</a></td><td align=right>$top[rank]</td></tr>";

}

?>

  </table>

 

<br>

<br>

 

      <table width="100%" border="0" cellspacing="2" cellpadding="0" align="center">

  <tr>

    <td width="200%" height="122" valign="top"><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="<?php echo "$td_border"; ?>" bgcolor="#666666">

        <tr>

          <td height="22" colspan="2" background="includes/grad.jpg"><center class="TableHeading">

              <font color="#FFFFFF">10 Richest Players </center></td>

        </tr>

        <tr>

          <td width="127" height="10" valign="top"><b>Username</b></td>

          <td width="136" valign="top"><b>Rank</b></td>

        </tr>

       

        <?php

$tsel = mysql_query("select * from `users` where `userlevel`='0' and `status`='alive' order by `money` desc limit 10");

while ($top = mysql_fetch_array($tsel)) { Line 56

print "<tr><td><a href=profile.php?viewuser=$top[username]>$top[username]</a></td><td align=right>$top[rank]</td></</tr>";

}

?>

      </table>

 

 

<table width="100%" border="0" cellspacing="4" cellpadding="2">

  <tr>

    <td width="274" height="122" valign="top"><table width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="<?php echo "$td_border"; ?>" bgcolor="#666666">

        <tr>

          <td height="22" colspan="2" background="includes/grad.jpg"><center class="TableHeading">

              <font color="#FFFFFF">Top 10 Forum Posters </center></td>

        </tr>

        <tr>

          <td width="127" height="10" valign="top"><b>Username</b></td>

          <td width="136" valign="top"><b>Posts</b></td>

        </tr>

        <center><?php

$tsel = mysql_query("select * from `users` where `userlevel`='0' and `status`='alive' order by `posts` desc limit 10");

while ($top = mysql_fetch_array($tsel)) {  line 76

print "<tr><td></center><a href=profile.php?viewuser=$top[username]>$top[username]</a></td><td align=right>$top[posts]</td></tr>";

}

?>

  </table>

 

<br>

<br>

 

 

 

</td>

   

</table>

</body>

</html></center>

Link to comment
https://forums.phpfreaks.com/topic/53529-warning-mysql_fetch_array/
Share on other sites

Change this line:

 

<?php
   $tsel = mysql_query("select * from `users` where `userlevel`='0' and `status`='alive' order by `rank` desc limit 10");
while ($top=mysql_fetch_array($tsel)) { // line 36
      print "<tr><td></center><a href=profile.php?viewuser=$top[username]>$top[username][/url]</td><td align=right>$top[rank]</td></tr>";
   }
   ?>

 

To this:

<?php
   $tsel = mysql_query($query = "select * from `users` where `userlevel`='0' and `status`='alive' order by `rank` desc limit 10") or trigger_error(mysql_error()."<PRE>".$query."</PRE>", E_USER_ERROR);;
while ($top=mysql_fetch_array($tsel)) { // line 36
      print "<tr><td></center><a href=profile.php?viewuser=$top[username]>$top[username][/url]</td><td align=right>$top[rank]</td></tr>";
   }
   ?>

 

... and investigate the mysql error.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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...

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.