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";
}
?>

Recommended Answers

All 3 Replies

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

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!

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.