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

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

WBOY
Release: 2016-06-13 10:09:23
Original
1060 people have browsed it

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

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->$query=mysql_query("insert into yc_jiage(yc_jiage,add_date,yc_name,yc_id) values ($_price1,$_date1,'毛衣'`,null)");
Copy after login

插入语句,没有任何提示,但数据就是没有插入!
PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->echo $_date1
Copy after login
倒是能正常显示,说明变量没有问题!

$_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)");
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template