我從upc數據庫檢索數據,然後想要將數據插入到我自己的數據庫中所有的代碼都是正確的,但是當我檢查我的數據庫時,我的數據庫表中沒有記錄我的代碼是數據插入問題
if(!$resp->faultCode()) { //Store the value of the response in a variable $val = $resp->value(); //Decode the value, into an array. $data = XML_RPC_decode($val); //Optionally print the array to the screen to inspect the values echo $upc=$data['upc']; echo $ean=$data['ean']; echo $description=$data['description']; echo $size=$data['size']; $query1="INSERT INTO upc(upc,ean,description,size) values('$upc','$ean','$description','$size')"; var_dump($query1); $result1=mysql_query($query1);請注意,我回應所有的變數,結果如下所示
639382000393 0639382000393 The Teenager's Guide to the Real World by BYG Publishing book string(166) "INSERT INTO upc(upc,ean,description,size) values('639382000393 ','0639382000393 ','The Teenager's Guide to the Real World by BYG Publishing ','book ')" You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 's Guide to the Real World by BYG Publishing ','book ')' at line 1但我的表格中沒有插入任何數據
mysql_query返回什麼? `true`還是`false`?如果`mysql_query`返回`false`,你總能得到錯誤信息'mysql_error` – PatrikAkerstrand 2011-02-03 11:44:17
我更新我的問題,錯誤 – hunter 2011-02-03 11:51:28