I keep on receiving an error message using mysql_num_rows(), can you help me figure out what went wrong on my code?
Here's my code:
<?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 <a href="customer_login.php">Click Here</a>';
        exit();
    }
}
?>
I've tried mysql_errno() as you advised.. and it echo 1146
and when I search for that error it says that
1146: Table 'kossu.nonexistenttable' doesn't exist
But I don't know what it means... Please help.