How can I check if value is in mysql’s table’s column?
Right now I’m creating a login system. After the user registers my php file posts the value and makes it into a variable. I was wondering what code i can use to compare my value to those values in the table and to check whether or not there is a value identical to the value entered.
I tried this code.
$query = "SELECT * FROM users WHERE username ='$username';";
$res = mysql_num_rows(mysql_query($query));
and then if ($res >= 0);
but then i get this error,
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/synameg1/public_html/giveaway/appfiles/register.php on line 23
so i was wondering if there is either a way to fix this error or do what i want to do in another method.
Thanks!
1 Answer