ERROR: Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\...\....php on line 19
<p>I keep on receiving an error message using <code>mysql_num_rows()</code>, can you help me figure out what went wrong on my code?</p>

<p>Here's my code:</p>

<pre><code>&lt;?php 
//check if the user press submit
if (isset($_POST['submit'] )) {

    $customer = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["username"]); // filter everything but numbers and letters
    $password = preg_replace('#[^A-Za-z0-9]#i', '', $_POST["password"]); // filter everything but numbers and letters

    $sql = mysql_query("SELECT id FROM members WHERE username='$customer' AND password='$password' LIMIT 1"); // query the person
    // ------- MAKE SURE PERSON EXISTS IN DATABASE ---------
    $existCount = mysql_num_rows($sql); // count the row nums
    if ($existCount == 1) { // evaluate the count
         while($row = mysql_fetch_array($sql)){ 
             $id = $row["id"];
         }
         $_SESSION["id"] = $id;
         $_SESSION["customer"] = $customer;
         $_SESSION["password"] = $password;
         header("location: index.php");
         exit();
    } else {
        echo 'That information is incorrect, try again &lt;a href="customer_login.php"&gt;Click Here&lt;/a&gt;';
        exit();
    }
}
?&gt;
</code></pre>

<p>I've tried <code>mysql_errno()</code> as you advised.. and it echo 1146</p>

<p>and when I search for that error it says that</p>

<pre><code>1146: Table 'kossu.nonexistenttable' doesn't exist
</code></pre>

<p>But I don't know what it means... Please help.</p>
