Page 1 of 1

Recording php Cookie to mySql DB

Posted: Wed Oct 15, 2008 11:09 am
by youngdeveloper
Hi guys, im fairly new to php and mysql.

Im basically trying to record the date/timestamp that the user clicks on a certain link and record it in a field in my table in my database.

Thanks for any help...

if(isset($_COOKIE['visittime']))
{
echo 'Welcome back!<br>';


$timeElapsed = date("F j, Y, g:i a");
$_COOKIE['visittime'] = $timeElapsed;

echo 'Last accessed ' . $timeElapsed. '' ;
}
else
{
echo 'I see you are new here';
}

//Set the current time as a cookie and make it expire much later.
$nextYear = time() + (60 * 60 * 24 * 365);
setcookie('visittime', time(), $nextYear);