How do you turn a php/mysql value into a cookie?

Say I have a query that selects userID from a mysql database and turn it into a cookie, how do I go about that?

$userID = $row['userID']; //Here is the variable I want turned into cookie, note that the query is not included here but it works as I have other cookies working with it.

setcookie ('userID',$userID,time()+9600,'/'); //Here is actual cookie but this doesnt seem to be working.

I've tried adding single and double quotes around $userID in the setcookie part but still nothing.

Any ideas on how to get this ID into a cookie?
 
Back
Top