Why is this statement not executed? Solution

Source: Internet
Author: User
Why is this statement not executed? PHPcode $ query = mysql_query (& quot; insertintoyc_jiage (yc_jiage, add_date, yc_name, yc_id) values ($ _ price1, $ _ date1, 'sweater '', null) & quot;); why is this statement not executed?
PHP code
  $ Query = mysql_query ("insert into yc_jiage (yc_jiage, add_date, yc_name, yc_id) values ($ _ price1, $ _ date1, 'sweater'', null )");

Insert statement, no prompt, but data is not inserted!
PHP code
  echo $_date1
The display is normal, indicating that the variable is correct!

$ _ Price1 and $ _ date1 are all variables received by POST!
The yc_id field in the table increases automatically.

------ Solution --------------------
Mysql_query ("insert into yc_jiage (yc_jiage, add_date, yc_name) values ($ _ price1, $ _ date1, 'sweater ')");

Try it?
------ Solution --------------------
$ Query = mysql_query ("insert into yc_jiage (yc_jiage, add_date, yc_name, yc_id) values ('$ _ price1', '$ _ date1', 'sweater'', null) ") or die (mysql_error ());

Try this way. If the error message is returned.
------ Solution --------------------
$ Query = mysql_query ("insert into yc_jiage (yc_jiage, add_date, yc_name, yc_id) values ('$ _ price1', '$ _ date1', 'sweater ', null) ");

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.