奶头挺立呻吟高潮av全片,成人试看120秒体验区,性欧美极品v,A片高潮抽搐揉捏奶头视频

php語言

PHP插入數(shù)據(jù)庫的方法

時(shí)間:2024-07-03 07:53:22 php語言 我要投稿
  • 相關(guān)推薦

PHP插入數(shù)據(jù)庫的方法

  導(dǎo)語:PHP怎么插入數(shù)據(jù)庫呢?其實(shí)這個(gè)是一個(gè)比較簡(jiǎn)單的問題,下面你跟著百分網(wǎng)小編一起做就可以了。

  $ostype=$_POST['ostype'];

  $uuid=$_POST['uuid'];

  $nowtime=time();

  $username='XXXX';

  $userpass='XXXX';

  $dbhost='localhost';

  $dbdatabase='XXX';

  //生成一個(gè)連接

  $db_connect=mysql_connect($dbhost,$username,$userpass) or die("Unable to connect to the MySQL!");

  $ret_json;

  if(!$db_connect) {

  $ret_json=array('code'=>1001, 'message'=>'鏈接數(shù)據(jù)庫失敗');

  }

  else {

  mysql_select_db($dbdatabase,$db_connect);

  $result = mysql_query("INSERT INTO t_dblocal_userinformation (ID, OSTYPE, UUID, LASTDATE) VALUES (NULL, $ostype, $uuid, $nowtime)");

  if ($result) {

  $ret_json=array('code'=>1000, 'message'=>'插入數(shù)據(jù)庫成功');

  }

  else {

  $ret_json=array('code'=>1002, 'message'=>'插入數(shù)據(jù)庫失敗');

  }

  }

  $jobj=new stdclass();

  foreach($ret_json as $key=>$value){

  $jobj->$key=$value;

  }

  echo ''.json_encode($jobj);

  ?>

  為嘛插入數(shù)據(jù)庫失敗呢??

  ID是自增的主鍵,LASTDATE是DATE類型

  ------解決方案--------------------

  報(bào)錯(cuò)提示什么?

  如果LASTDATE是DATE類型 $nowtime=date(‘Y-m-d’);

  如果LASTDATE是DATETIME類型$nowtime=date(‘Y-m-d H:i:s');

  ------解決方案--------------------

  echo mysql_error(); 報(bào)什么錯(cuò)誤沒有

  ------解決方案--------------------

  少了引號(hào)了。

  $result = mysql_query("INSERT INTO t_dblocal_userinformation (ID, OSTYPE, UUID, LASTDATE) VALUES (NULL, '$ostype', '$uuid', '$nowtime')");

  ------解決方案--------------------

  引用:

  少了引號(hào)了。

  $result = mysql_query("INSERT INTO t_dblocal_userinformation (ID, OSTYPE, UUID, LASTDATE) VALUES (NULL, '$ostype', '$uuid', '$nowtime')");同意

  ------解決方案--------------------

  第一個(gè) 想樓上那樣說的 引號(hào)的問題

  第二個(gè) 你的time()是返回的時(shí)間戳,和date類型對(duì)應(yīng)不上吧 要轉(zhuǎn)化處理一下才行

【PHP插入數(shù)據(jù)庫的方法】相關(guān)文章:

PHP怎么插入數(shù)據(jù)庫07-09

php備份數(shù)據(jù)庫類的方法09-04

php實(shí)現(xiàn)插入數(shù)組但不影響原有順序的方法09-05

PHP使用中數(shù)據(jù)庫使用方法05-21

自學(xué)PHP方法09-24

php連接mysql數(shù)據(jù)庫代碼08-01

PHP數(shù)據(jù)庫:mysql重置密碼07-20

PHP的安裝方法及軟件09-04

PHP偽靜態(tài)的方法10-26

解決php fsockopen的方法07-14

主站蜘蛛池模板: 斗六市| 丹巴县| 西华县| 漯河市| 靖州| 杭锦后旗| 邯郸市| 玉环县| 汉川市| 手机| 南川市| 固原市| 连江县| 通城县| 通山县| 景德镇市| 南漳县| 象州县| 曲水县| 奎屯市| 景东| 棋牌| 西盟| 玉门市| 阿克苏市| 吉木乃县| 扶风县| 洛隆县| 兴业县| 印江| 宾阳县| 耒阳市| 长岭县| 托克托县| 建宁县| 金秀| 若尔盖县| 汉川市| 塘沽区| 宁陕县| 阳朔县|