mjnmixael Posted November 20, 2009 Share Posted November 20, 2009 Here is my code. $sql="SELECT user_email FROM $tbl_name WHERE user_login='$myusername' and user_pass='$mypassword'"; $array=mysql_query($sql); $ekeep=$array[user_email]; setcookie("useremail", $ekeep, time()+60*60*24*100, "/", '.timingishstudios.com'); I'm trying to select a specific cell in the table. I can't imagine what isn't working with this script. I don't think I'm grabbing the data correctly. Quote Link to comment https://forums.phpfreaks.com/topic/182242-storing-value-in-cookie/ Share on other sites More sharing options...
Alex Posted November 20, 2009 Share Posted November 20, 2009 You need to actually get the record from the mysql resource with a function such as mysql_fetch_assoc. You also are using an undefined constant on this line: $ekeep=$array[user_email]; An error might not be thrown depending on how high your error reporting is turned up, but it's still not good to do. $sql="SELECT user_email FROM $tbl_name WHERE user_login='$myusername' and user_pass='$mypassword'"; $result=mysql_query($sql); $row = mysql_fetch_assoc($result); $ekeep=$row['user_email']; setcookie("useremail", $ekeep, time()+60*60*24*100, "/", '.timingishstudios.com'); Quote Link to comment https://forums.phpfreaks.com/topic/182242-storing-value-in-cookie/#findComment-961652 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.