I do this thing:

$time = time(); $online = $time - (20*60); $result = mysql_query("SELECT username FROM users WHERE users_come >= $online"); while( $row = mysql_fetch_array( $result ) ){ echo "<br>{$row['username']}"; } 

It displays users on-line, but I get the following error:

Warning: mysql_fetch_array () expects parameter 1 to be resource, given in C: xampphtdocsstyleonline.php on line 20

What does it mean and how to fix it please tell me!

Reported as a duplicate by Athari , Yura Ivanov , Maxim Kamalov , ixSci , AntonioK May 16 '15 at 6:06 .

A similar question was asked earlier and an answer has already been received. If the answers provided are not exhaustive, please ask a new question .

  • Are you sure that the error is in this piece of code? - Zowie
  • yes, precisely in this - k0mar

1 answer 1

most likely you could not connect to the database. Or the request is not correct. For example, there is no field or it is called differently.

do after

 $result = mysql_query("SELECT username FROM users WHERE users_come >= $online"); var_dump(mysql_error()); 
  • yeah, thanks a lot =) So it is =) - k0mar