An error occurred while executing the SQL statement in PHP, but the same statement can be executed in MYSQL.
Source: Internet
Author: User
PHP fails to execute the SQL statement, but the current problem that the same statement can be executed in MYSQL is that some tables in the same database can be queried, and some tables cannot be queried. However, these statements can be normally executed in mysql. In one case, LZ can be checked in PHP and combined into SQL statements. & nbsp; output the generated SQL statement to check if the SQL statement executed by & nb PHP fails, but the same statement can be executed in MYSQL.
The problem is that some tables in the same database can be queried, and some tables cannot be queried. However, these statements can be executed normally in mysql.
------ Solution --------------------
In one case and one case, LZ can combine the SQL statements in PHP and output the generated SQL statements to check whether the data is properly encoded in the background.
------ Solution --------------------
Can the same SQL statement be directly inserted in the database?
Check the SQL statements written in PHP.
------ Solution --------------------
Directly echo to see what the output is.
------ Solution --------------------
If the permission is okay, it must be because your SQL has a problem.
Print the final SQL statement to be executed
------ Solution --------------------
Mysql_query ($ SQL) or die (mysql_error ());
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.