Okay so i have to make a signup form and i have pretty much everything finished but i keep getting this error Warning: mysql_num_rows() expects parameter 1 to be resource. I keep getting this error on my $checkUserQuery & $checkEmailQuery and don't know how to fix it. Any Suggestions?
<?php
$db_name = "htmldb";
$tbl_name = "phplogin";
//connect to database
$conn = mysql_connect("localhost","root","");
mysql_select_db("$db_name");
//post back to database and checks userName
//and email for no duplicates in database
if($_POST['submit']){
$first = $_POST['firstName'];
$last = $_POST['lastName'];
$user = $_POST['userName'];
$pass = $_POST['p'];
$email = $_POST['email'];
$checkUserQuery = mysql_query("SELECT * FROM $tbl_name WHERE userName = '$user'");
$checkEmailQuery = mysql_query("SELECT * FROM $tbl_name WHERE email = '$email'");
if(!$first OR !$last OR !$user OR !$pass OR !$email)
{
echo("Error: Please make sure all fields are filled out!");
}
elseif(mysql_num_rows($checkUserQuery) > 0)
{
echo("Error: Username already exists!");
}
elseif(mysql_num_rows($checkEmailQuery) > 0)
{
echo("Error: E-mail Address has already been used please user another one!");
}
else
{
$query = mysql_query("INSERT INTO phplogin
VALUES(".$first.",'".$last."','".$user."','".$pass."','".$email."')");
echo("Sign Up Successful!");
}
}
?>