cswells Posted April 15, 2010 Share Posted April 15, 2010 $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. Link to comment https://forums.phpfreaks.com/topic/198682-cookie-creation/ Share on other sites More sharing options...
taquitosensei Posted April 15, 2010 Share Posted April 15, 2010 $user_data = mysql_fetch_array($res_check_e); <says error is here $username = $userdata['username']; $userdata!=$user_data Link to comment https://forums.phpfreaks.com/topic/198682-cookie-creation/#findComment-1042641 Share on other sites More sharing options...
cswells Posted April 15, 2010 Author Share Posted April 15, 2010 I just found this.... :'( Link to comment https://forums.phpfreaks.com/topic/198682-cookie-creation/#findComment-1042645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.