Jump to content

Storing Value In Cookie


mjnmixael

Recommended Posts

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.

Link to comment
Share on other sites

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');

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.