validate if user exist or not

I have email and password in the database.
The connection work well.
the function must see if there is any email exist in the database
but there is some problem with the text:

login.php
[php]
if(user_check($email)==TRUE)
{
echo “user exist”;
}
else
{
echo “user not exist”;
}
[/php]

this page call for function.php
[php]
function user_check($email)
{
$res = mysql_query(“select * from users where email=’$email’”);
$row = mysql_fetch_array($res);
if($row[‘email’] == $email)
{
$email == TRUE;
}
else
{
$email == FALSE;
}
return($email);
}
[/php]

what the problem?

I made some some changes to your function.
[php]
function user_check($email)
{
$res = mysql_query(“select * from users where email=’$email’”);
$row = mysql_fetch_array($res);

if ($row['email'] == $email)
{
return TRUE;	
}
else
{
return FALSE;	
}

}
[/php]

Thanks A LOT!

you are welcome…

Sponsor our Newsletter | Privacy Policy | Terms of Service