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 ------ solution ------------------ check in one case, LZ can be combined into an SQL statement on the PHP side & nbsp; output the generated SQL statement to see & nbsp; check if the data fails to execute the SQL statement in the background PHP, 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 ());

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.