MYSQL错误:MySQL server version for the right syntax to use nea
MYSQL错误:MySQL server version for the right syntax to use near '1' at line 1
PHP插入数据
$linkDB01 = mysql_connect("local","amount","code");
x05mysql_select_db("blueShine01",$linkDB01);
x05mysql_query("set names utf8;");
x05$insert01 = mysql_query( "INSERT INTO barCodeTB01 (barCode,uploadTime,agencyName,queryTime,checkTime)VALUES('112233445566','20140908','哈哈',NOW(),'1') ");x05
//插入数据
x05if mysql_query($insert01,$linkDB01)) { die('Error:' .mysql_error()); } else { echo "1 record added"; };x05
//询问是否插入数据成功
mysql_close($linkDB01);
数据可以成功插入,在数据库内能查到.但是同时的会页面也会返回
Error: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 '1' at line 1.
噢···知道了
$insert01 = mysql_query( "INSERT INTO barCodeTB01 (barCode,uploadTime,agencyName,queryTime,checkTime)VALUES('112233445566','20140908','哈哈',NOW(),'1') ");x05
//赋值插入数据这一句是不能加mysql_query()的
改成:
$insert01 = "INSERT INTO barCodeTB01 (barCode,uploadTime,agencyName,queryTime,checkTime)VALUES('112233445566','20140908','哈哈',NOW(),'1')";
//这样就没问题了萌萌哒~