user1393109 user1393109 - 6 months ago 57
SQL Question

Insert cookies data into MySQL database in PHP?


Possible Duplicate:

How to get offline cookies data with php and insert it in mysql?

Get cookies in php?




I have some users information saved in cookie, the users information are like this,

Fname:Muhammad,Lname:Riaz,title:Developer,org:MagicLamp,email:riaz@yaho.com
Fname:Fraz,Lname:Khan,title:Developer,org:MagicLamp,email:riaz@yaho.com


I want to insert these information in to MySQL database. The problem is this: how can I get this information from a cookie and insert into database?

Answer
$str = "";

foreach ($_COOKIE as $key => $value)
{
    $str .= $key . ":" . $value . ",";
}

$str = substr($str, 0, -1);
Comments