php check if a value is in a sql database <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-boolean-given-in-select">mysql_fetch_array() expects parameter 1 to be resource, boolean given in select</a> </p> </blockquote> <pre><code>//define variable to check the number of rows where the sql query is true to find out if the username or password are already in use $EmailCheck = mysql_query("SELECT `Email` FROM `Customer` WHERE `Email` = '$RegCusEmail'"); $UserCheck = mysql_query("SELECT `Username` FROM `Customer` WHERE `Username` = '$RegCusUser'"); //checks if emails in use if (mysql_num_rows($EmailCheck) != 0) { echo '&lt;p id="error"&gt;The Email address you have entered is already in use.&lt;p&gt;'; } //checks if username is in use elseif (mysql_num_rows($UserCheck) != 0) { echo '&lt;p id="error"&gt;The username you have entered is already in use.&lt;p&gt;'; } </code></pre> <p>The above code is supposed to search a database for the email and username of the person registering and if they already exist tell the user to use a different one but when I use it I get this error?</p> <blockquote> <pre><code>Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in (file directory) on line 56 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in (file directory) on line 62 </code></pre> </blockquote>