$polls = mysql_fetch_array (mysql_query ("SELECT title, time, number FROM table"));
$title = $polls['title'];
$time = $polls['time'] + time ();
$number = $polls['number'] + 1;
setcookie ($title, $number, $time);
Those are the bits of code which directly affect the setcookie function.
Also I use:
if (isset ($_COOKIE[$poll['title']])) {
echo "cookie is set<br><br>";
}
where I retrieve title from another query.