Hit the ghost, simple database query, display unknown column ' titletest ' in ' Field list '
Source: Internet
Author: User
Encounter Ghost, simple database query, display unknown column ' titletest ' in ' Field list '
Data fields: ID (self-increment), title (varchar (50), content (Longtext)
Code for
$title = $_post[' title ']; (Value: titletest)
$content =$_post[' content '; (value: Contenttest)
$insert = "INSERT into article (title,content) VALUES (". $title. ', '. $content. ");
Error: Unknown column ' Titletest ' in ' Field list '
Code for
$title = $_post[' title ']; (The value is: Title test) This and the above one more space
$content =$_post[' content '; (value: Contenttest)
$insert = "INSERT into article (title,content) VALUES (". $title. ', '. $content. ");
The error is:
You have a error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use near ' test,contenttest ' in Lin E 1
$insert = "INSERT into article (title,content) VALUES (". $title. ', '. $content. ");
In the $title, $content can be inserted into a string
------Solution--------------------
There is a problem with the statement, so $insert = "INSERT into article (title,content) VALUES (' $title ', ' $content ')";
------Solution--------------------
SQL string has a problem, try this $insert = "INSERT into article (title,content) VALUES ('". $title. "', '". $content. "')";
------Solution--------------------
$insert = "INSERT into article (title,content) VALUES (' $title ', ' $content ')";
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.