I get the following error telling me my argument is not acceptable for the mysql_num_rows command. In the code below, row 6 = to row 19 in the error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\wamp\www\register.php on line 19
Is there something wrong with my $query statement above it?
Code: Select all
if($_POST['submit']){
$_POST['username'] = trim($_POST['username']);
if($_POST['username'] && strlen($_POST['username']) >=3){
$query = mysql_query("SELECT 'id' FROM 'users' WHERE 'username'='".$_POST['username']."' LIMIT 1");
if(mysql_num_rows($query)){
$error['userexists'] = 'Username exists';
}
}
else {
$error['usernameinput'] = 'Please enter a username of 3+ characters';
}
}