Why can't my code be written into the database?

Source: Internet
Author: User
Why can't I write my code to the database? I have a registration system with a submission page that uploads the input information from the submission page to another PHP for writing. But I don't know how, I can't write ...... My code is & lt ;? Phprequire_once (... configconfig_database.php); $ name $ _ POST [name]; $ ccid: why can't my code be written to the database?
I made a registration system with a submission page that uploads the input information from the submission page to another PHP file for writing. But I don't know how, I can't write ......


My code is
Require_once ("../config/config_database.php ");
$ Name = $ _ POST ['name'];
$ Cid = $ _ POST ['CID'];
$ Xh = $ POST ['xh'];
$ Tel = $ POST ['tel'];
$ Bx = $ POST ['bx '];
$ Exec = "insert into xx values ($ name, '$ Cid', $ xh,' $ tel ', $ bx )";

$ Result = mysql_query ($ exec );
If ($ result)
{
Echo "you have registered successfully ";
}
Else
{
Echo "Sorry, database writing failed. please register again! ";
}
Mysql_close ();
?>


Please enlighten me.


------ Solution --------------------
$ Result = mysql_query ($ exec) or die (mysql_error (); // if this error is returned, no
------ Solution --------------------
$ Exec = "insert into xx (corresponding fields in the database, without quotation marks) values ('$ name',' $ Cid', $ xh, '$ tel ', '$ bx ')";

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.