遇到鬼了,简单的数据库查询,显示Unknown column 'titletest' in 'field list'
新金矿 2014-09-01 05:32:45 数据字段为:id(自增)、title(varchar(50)、content(longtext)
代码为
$title = $_POST['title']; (值为:titletest)
$content =$_POST['content'];(值为:contenttest )
$insert = "insert into article(title,content) values(".$title.','.$content.")";
错误为:Unknown column 'titletest' in 'field list'
代码为
$title = $_POST['title']; (值为:title test)这个和上面的多一个空格
$content =$_POST['content'];(值为:contenttest )
$insert = "insert into article(title,content) values(".$title.','.$content.")";
错误为:
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 'test,contenttest)' at line 1
将$insert = "insert into article(title,content) values(".$title.','.$content.")";
中的$title, $content 换成字符串就可以插入