Wrote a simple message board release code, but always can not put the message into the MySQL database, ask the big God pointing abnormal

Source: Internet
Author: User
Tags php and mysql
Wrote a simple message board release code, but always can not put the message into the MySQL database, ask the big God pointing wrong!
i beginner php and MySQL, imitate php100 video tutorial to do a message board publishing site, but click on the "message" button always pops up "message failed!" , at the same time the database also did not import information, ask the big God to see which out of the code problems, thank you!
Database name: Test_liuyanban
Table Name: Message
Fields: Int (primary key), username (username), email (email), content (message).
Altogether two documents: conn.php and index.php
conn.php:
$conn = @mysql_connect (' localhost ', ' root ', ' 12345 ') or Die (' Connection failed! ');
@mysql_select_db ("Test_liuyanban") or Die (' No database! ');
mysql_query ("Set names ' GBK '");
?>

index.php:
Include_once ' conn.php ';
if ($_post[' POST ']) {
$sql = "INSERT INTO ' message ' (id,username,email,content) VALUES (' ', ' $_post[username] ', ' $_post[email] ', ' $_post[ Content] ";
$result =mysql_query ($sql);
if ($result) {
echo "";
}else{
echo "";
}
}
?>








Share to:


------Solution--------------------
$sql = "INSERT INTO ' message ' (id,username,email,content) VALUES (', $_post[' username '],$_post[' email '],$_post[' Content ']) ";
------Solution--------------------
There is no email field in your table, show create table message; Look
  • Related Article

    Contact Us

    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.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.