title: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in?
body: <p>I'm trying to make a log in system using PHP but when I purposely attempt to log in with incorrect credentials this error message appears: </p>
  
  <p><code>Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in ...</code></p>
  
  <p>The message I want to echo when someone types in the wrong credentials appears, but it appears below the warning message. These are the lines of code associated with the line of code causing the warning message to appear:</p>
  
  <pre><code>$query = mysql_query("SELECT * FROM users WHERE username='$user'");
  if ($numrows == 1){
  $row = mysql_fetch_assoc($query);
  $dbid = $row['id'];
  $dbuser = $row['username'];
  $dbpass = $row['password'];
  $dbactive = $row['active'];
  </code></pre>
  
  <p>And here is the actual line of code itself:</p>
  
  <pre><code>$numrows = mysql_num_rows($query);
  </code></pre>
  
  <p>I may need to edit the question to add more lines of code, please tell me if I do. Also this question may be a possible duplicate of this post: <a href="https://stackoverflow.com/questions/5473981/warning-mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-i">Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in</a> but I'm not too sure though. But please tell me what could be causing this warning message to appear.</p>