$sql_check_e = "SELECT * FROM `tbl` WHERE `email`='".$email."'";
$res_check_e = mysql_query($sql_check_e) or die(mysql_error());
if(mysql_num_rows($res_check_e) == 0){
echo "The email you supplied does not exist, please regiester <a>here</a>\n";
}else{
$sql_password = "SELECT * FROM `tbl` WHERE `email`='".$email."' AND `password`='".md5($password)."'";
$res_password = mysql_query($sql_password) or die(mysql_error());
if(mysql_num_rows($res_password) == 0){
echo "Email or password is invalid";
}else {
//at this point login is successful
$user_data = mysql_fetch_array($res_check_e); <says error is here
$username = $userdata['username'];
setcookie($username,$email,time()+3600);
I have the user login with Email and Password, but i want the Cookie to store the Username, and email.
The error i get is "Notice: Undefined variable: userdata"
Any help would be key. I am probably making a mistake thats right in front of me and yet don't get it.