Home  >  Article  >  Backend Development  >  这条语句为什么没有执行?解决思路

这条语句为什么没有执行?解决思路

WBOY
WBOYOriginal
2016-06-13 13:48:08851browse

这条语句为什么没有执行?

PHP code
$query=mysql_query("insert into yc_jiage(yc_jiage,add_date,yc_name,yc_id) values ($_price1,$_date1,'毛衣'`,null)");


插入语句,没有任何提示,但数据就是没有插入!
PHP code
echo $_date1
倒是能正常显示,说明变量没有问题!

$_price1和 $_date1 都是POST接收来的变量!
表中 yc_id 字段,是自动增长的

------解决方案--------------------
mysql_query("insert into yc_jiage(yc_jiage,add_date,yc_name) values ($_price1,$_date1,'毛衣')");

试试看?
------解决方案--------------------
$query=mysql_query("insert into yc_jiage(yc_jiage,add_date,yc_name,yc_id) values ('$_price1','$_date1','毛衣'`,null)") or die(mysql_error()); 

这样试试。错了的话有提示。
------解决方案--------------------
$query=mysql_query("insert into yc_jiage(yc_jiage,add_date,yc_name,yc_id) values ('$_price1','$_date1','毛衣',null)");
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn