I want to create a php cookie that stores the username and the userid. Or is it better to just use one to get the other?
If you're only looking to store two values, it may just be easier to concatenate them and store it as such:
setcookie("acookie", $username . "," . $userid);
And to retrieve the information later,
if(isset($_COOKIE["acookie"])){
$pieces = explode(",", $_COOKIE["acookie"]);
$username = $pieces[0];
$userid = $pieces[1];
}
Cheers,
~Berserkguard
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With