I wrote this code and it works, but I’m still wondering if there is any other solution which is better and simpler.
$sql = "select * from db_member where username = '$name'";
$result = mysql_query($sql) or error(mysql_error());
if(mysql_num_rows($result) < 1)
{
error("There is no user with name '$name'.");
}
A faster way to do it:
Please check http://php.net/pdo for better error handling and query parameters….
I think using mysql_query this way shoulnd’t be done anymore..