Home > Backend Development > PHP Tutorial > php-mysql Problem Note 1 - SQL statements that can be executed on the command line cannot be executed from the php page!

php-mysql Problem Note 1 - SQL statements that can be executed on the command line cannot be executed from the php page!

WBOY
Release: 2016-08-08 09:28:21
Original
1333 people have browsed it

My situation:

1. Since there are many foreign keys, when inserting data, close the foreign keys in advance (SET FOREIGN_KEY_CHECKS=0).

2. The sql statement used has 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 who uses this statement is valid, and data can be inserted while ignoring foreign keys.

Experience summary:

For some special operations, modifying user permissions should return to the normal state in time, that is to say

SET FOREIGN_KEY_CHECKS=0;

sql statement

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

The above introduces the php-mysql problem note one - the sql statement that can be executed in the command line cannot be executed from the php page! , including relevant content, I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template