我正在做一项调查我是离线服务器所以我将用户信息保存在 cookie 中,我有这样的用户信息
Fname:Ali,Lname:Kheiri,title:Director,org:Magiclamp,email:alikheiri@gmail.com Fname:Ali,Lname:Kheiri,title:Director,org:Magiclamp,email:alikheiri@gmail.com
它保存在 cookie 中,但现在我在线,所以我想将此 cookie 数据保存在 php 中的 mysql 数据库中,为此我编写了这段代码,但它不起作用
mysql_connect("localhost","root","");//database connection05
mysql_select_db("o2measure");
if($_POST['submit']){
$date = date('Y,m,d');
$time = date("i:h:s",time() + $time_a);
echo $session_id;
$ip=$_SERVER['REMOTE_ADDR'];
foreach($_COOKIE as $name => $cookie){
// you can check any conditions based on cookie name $name
$sql="INSERT INTO user_data (first_name, last_name, job_title, organisation, email, phone_number, ip_address, date, time)
VALUES(" . mysql_escape_string($cookie) . ")";
$result=mysql_query($sql);
}