PHP has no way to submit data to the database

Source: Internet
Author: User
PHP database MySQL

Include ("connection.php");

if (Isset ($_post["sub"])) {
$title =$_post[' title ';
$con =$_post[' con '];
$sql = "INSERT INTO ' news ' (' IDs ', ' title ', ' dates ', ' contents ') VALUES (null, ' $title ', now (), ' $con ')";
mysql_query ($sql);
echo "Insert Success"; Data is not entered into the database after submission
}else{
echo "Insert Failed". Mysql_error ();
}

?>




Reply to discussion (solution)

mysql_query ($sql) or Die (Mysql_error ()); Do you have any errors?

I got it. Because the ID cannot be null but my phpmyadmin doesn't automatically increment this one.

mysql_query ($sql) or Die (Mysql_error ()); Do you have any errors?
Yes, but what about the problem with no incremental entry?

ID primary key, insert data automatically increment yes.

Auto_increment Property

Thank you all for finding the new version of phpMyAdmin is a_i the problem has been solved

  • 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.