久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

將我的 cookie 數(shù)據(jù)保存到 MySQL 數(shù)據(jù)庫?

Save my cookie data to MySQL database?(將我的 cookie 數(shù)據(jù)保存到 MySQL 數(shù)據(jù)庫?)
本文介紹了將我的 cookie 數(shù)據(jù)保存到 MySQL 數(shù)據(jù)庫?的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我在做一項(xiàng)調(diào)查,我是離線服務(wù)器,所以我將用戶信息保存在 cookie 中,我有這樣的用戶信息

I was doing a survey I was offline server so I save users information in cookies, I have users Information like this

Fname:Ali,Lname:Kheiri,title:Director,org:Magiclamp,email:alikheiri@gmail.comFname:Ali,Lname:Kheiri,title:Director,org:Magiclamp,email:alikheiri@gmail.com

它保存在cookies中,但現(xiàn)在我在線,所以我想將此cookies數(shù)據(jù)保存在php中的mysql數(shù)據(jù)庫中,為此我編寫了javascript代碼,但它不起作用

it is save in cookies, but now i am online, so i want to save this cookies data in mysql database in php, javascript for this I write this code but its not working

    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); 

}

推薦答案

你應(yīng)該將 cookie 值作為一個(gè)字符串拆分它并單獨(dú)使用每個(gè)條件而不是使用插入查詢,因?yàn)槟銓懙牟樵儾徽_你說插入 user_data名字 姓氏 職位名稱...但您只給他 1 個(gè)值 $cookie 但 sql 不知道 $cookie 包含所有內(nèi)容,因此您應(yīng)該首先根據(jù) ',' slpit cookie 值

you should get the cookie value as a string split it and have every criteria alone than use the insert query because the query you wrote is incorrect you saying insert into user_data the first name the last name the job title... but you are only giving him 1 value the $cookie but the sql don't know that the $cookie contain everything so you should first slpit the cookie value based on the ','

這篇關(guān)于將我的 cookie 數(shù)據(jù)保存到 MySQL 數(shù)據(jù)庫?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Joining 2 tables in SELECT(MYSQL/PHP)(在 SELECT(MYSQL/PHP) 中加入 2 個(gè)表)
How to make lt;option selected=quot;selectedquot;gt; set by MySQL and PHP?(如何使lt;option selected=“selectedgt;由 MySQL 和 PHP 設(shè)置?)
Auto populate a select box using an array in PHP(使用 PHP 中的數(shù)組自動填充選擇框)
PHP SQL SELECT where like search item with multiple words(PHP SQL SELECT where like search item with multiple words)
json_encode produce JSON_ERROR_UTF8 from MSSQL-SELECT(json_encode 從 MSSQL-SELECT 產(chǎn)生 JSON_ERROR_UTF8)
MySQL ORDER BY rand(), name ASC(MySQL ORDER BY rand(),名稱 ASC)
主站蜘蛛池模板: 免费观看一级毛片 | 国产成人精品高清久久 | 人人做人人澡人人爽欧美 | 夜夜骑首页 | 久久久国产精品 | 91麻豆精品国产91久久久更新资源速度超快 | 国产精品不卡一区 | 亚洲h在线观看 | 大陆一级毛片免费视频观看 | 欧美一级免费看 | 夜夜操天天艹 | 午夜视频一区 | 97久久久久久 | 欧美精品第三页 | 久久国产精品免费 | 国产精品日韩欧美一区二区三区 | 夫妻午夜影院 | 天天碰日日操 | 欧洲视频一区二区 | 亚洲女人天堂成人av在线 | 懂色av蜜桃av | aaa精品 | 国产成人在线一区 | 成人av网站在线观看 | 日韩欧美成人一区二区三区 | 国产精品久久av | 羞羞视频网站在线观看 | 久久av一区| 国产精品欧美精品日韩精品 | 日韩中文字幕一区二区 | 久久国产精品色av免费观看 | 日韩在线免费 | 亚洲高清一区二区三区 | www.免费看片.com | 岛国一区| 欧美日韩精品一区二区三区四区 | 久久欧美高清二区三区 | 超碰在线亚洲 | 久久久久亚洲精品中文字幕 | 久久新| 国产免费av在线 |