我有2個月的編程中斷。現在PHP腳本不起作用。語法有什麼變化?兩個月前我有php v5.3。現在它安裝了php 5.5;數據庫客戶端版本是libmysql - mysqlnd 5.0.11-dev;如何將值插入MySql數據庫? PHP v5.5,libmysql - mysqlnd 5.0.11-dev
這是工作的前兩個月,但現在無法正常工作代碼:
$str1="INSERT INTO ".$vtbname." (tcdbname, tctname, tccolname, tcbComp) VALUES ('$vdbname', '$vtbnameFrom', '$colname', 0)";
$ans1 = mysqli_query($conn, $str1);
if(! $ans1 ) { die('<br>1. Could not enter data to: '.$vdbname.'.'.$vtbname.' : '. mysqli_error()); }
else { echo "<br>1.Inserted successfully to ".$vdbname.".".$vtbname;}
echo "<br>str1=".$str1;
在phpMyAdmin顯示的語法,但它不會從腳本工作:
$str1="INSERT INTO `".$vdbname."`.`".$vtbname."` (`tcdbname`, `tctname`, `tccolname`, `tcbComp`,) VALUES ('".$vdbname."', '".$vtbnameFrom."', '".$colname."', '0')";
$ans1 = mysqli_query($conn, $str1);
if(! $ans1 ) { die('<br>1. Could not enter data to: '.$vdbname.'.'.$vtbname.' : '. mysqli_error()); }
else { echo "<br>1.Inserted successfully to ".$vdbname.".".$vtbname;}
echo "<br>str1=".$str1;
在這兩種情況下,值沒有插入我得到錯誤和str1迴應調試目的:
str1=INSERT INTO `gintare_calendar`.`tinfotlogin` (`tcdbname`, `tctname`, `tccolname`, `tcbComp`) VALUES ('gintare_calendar', 'tlogin', 'tcid' '0')
Warning: mysqli_error() expects exactly 1 parameter, 0 given in C:\xampp\htdocs\CreateInfoDBsimple.php on line 90
給連接參數作爲參數傳遞給你的'mysqli_error($ conn);在',如圖所示。 –
你得到什麼錯誤消息請提及錯誤 –