我从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