I have this code to check if user exists in database. I want to assign $account to 1 if it exits, and 0 if it doesn't. I thought this code would work but its constantly setting $account to 0 so I think im missing a trick. Any help would be appreciated.
$con = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
 if (!$con)
 {
 die('Could not connect: ' . mysql_error());
 }
mysql_select_db(DB_NAME, $con);
$sql="SELECT user_name FROM users";
$result = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_assoc($result);
if ($row['user_name'] == '$user_name'){
$account = 1;
}else{
        $account = 0;}
Thanks
 
     
     
     
    