0

I am getting this error on other pages that lead to this one, but i can't find out what I'm doing wrong... can anyone help? The error reads: Warning: mysql_numrows(): supplied argument is not a valid MySQL result resource in ...on line 9. Can anyone help me?

<?
if(!defined('TBL_ACTIVE_USERS')) {
  die("Error processing page");
}

$q = "SELECT username FROM ".TBL_ACTIVE_USERS
    ." ORDER BY timestamp DESC,username";
$result = $database->query($q);
$num_rows = mysql_numrows($result);
if(!$result || ($num_rows < 0)){
   echo "Error displaying info";
}
else if($num_rows > 0){
   echo "<table align=\"left\" border=\"1\" cellspacing=\"0\" cellpadding=\"3\">\n";
   echo "<tr><td><font size=\"2\">\n";
   for($i=0; $i<$num_rows; $i++){
      $uname = mysql_result($result,$i,"username");

      echo "<a href=\"userinfo.php?user=$uname\">$uname</a> / ";
   }
   echo "</font></td></tr></table><br>\n";
}
?>
3
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by erry
0

Hello,

Most of time this error come because of your query is not execute properly..

you please echo that query & try to run that into "phpmyadmin" or whatever you use for mysql, so you find actual problem..

I hope this will solve your problem..

0

thank you i think i figured out the problem in that one, but it hasnt help the others, ill put the errors with them here: Warning: Cannot modify header information - headers already sent by (output started at...in process.php on line 159.

Here is line 159:

header("Location: ".$session->main);

I am extremely sure i have done something really incorrect since I am new to php, so if you can help, thank you!

0

Hi, take care to not print anything to screen before you call header function otherwise it would not work.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.