user2324069
user2324069

Reputation: 33

Retrieve cookie VALUE in PHP

I'm trying to retrieve the cookie's value by simply calling its indexed position in the array, which is 1. However, I'm getting an error message saying 1 is an undefined offset? When I know for a fact it is in position 1. Am I missing something??

$query = "SELECT * FROM basketID" . $_COOKIE[1];

I've set the cookie like this

setcookie('visitUid',$uid,time()+60*60*24*7, '/');

$uid is a randomly generated number btw.

Upvotes: 0

Views: 160

Answers (1)

Class
Class

Reputation: 3160

$_COOKIE['visitUid'] is what you are looking for

Upvotes: 3

Related Questions