Php-mysql question Note 1-SQL statements that can be executed in the command line cannot be executed from the php page !, Php-mysqlsql_PHP tutorial

Source: Internet
Author: User
Php-mysql question Note 1-SQL statements that can be executed in the command line cannot be executed from the php page !, Php-mysqlsql. Php-mysql question Note 1-SQL statements that can be executed in the command line cannot be executed from the php page !, Php-mysqlsql: 1. due to the large number of foreign keys, when inserting data, take notes on php-mysql -- SQL statements that can be executed in the command line cannot be executed from the php page !, Php-mysqlsql

My situation:

1. because there are many foreign keys, SET FOREIGN_KEY_CHECKS = 0 when inserting data ).

2. the SQL statement used contains foreign keys bound to other tables, so it cannot be inserted from the php page.

Cause analysis:

SET FOREIGN_KEY_CHECKS = 0. This command is only valid for a single database user, that is, the user using this statement is valid. you can insert data when the foreign key is ignored.

Experience Summary:

For some special operations, modify the user permissions, and the normal status should be promptly replied, that is

SET FOREIGN_KEY_CHECKS = 0;

SQL statement

SET FOREIGN_KEY_CHECKS = 1; * ******************************** this is very important *** *****************************

Http://www.bkjia.com/PHPjc/966827.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/966827.htmlTechArticlephp-mysql problem Note 1-SQL statements that can be executed in the command line, cannot be executed from the php page !, Php-mysqlsql: 1. when inserting data due to a large number of foreign keys...

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.