PDO version problem Invalid parameter number: no parameters were bound

Source: Internet
Author: User

In a certain PHP version of the customer, the following error Invalid parameter number: no parameters were bound is always reported during certain operations. google found that the php version was too low.

Body:

Today, when dealing with bugs, I found a very strange problem. When performing some operations, I will report: Invalid parameter number: no parameters were bound, but the problem in the local or test machine test are not reproduced, guess whether it is related to the version, so google, found http://forum.typecho.org/topic.php? Id = 1501 said on the second floor of the article that this issue is a version bug that will appear in pdo below php5.2.9. So I found another sub-engineer (5.2.6) in the team to perform the test. The problem was fixed again. The problem was tested on 5.2.17 on his server, and the problem did not occur.

During debugging, the following service errors are reported when this type of operation occurs:

Use PDO to insert a piece of data into the table nw_log (table fields such as uid and content fields). The content field is <a href = 'http: //. xxx /? Tid = 1'> test </a>, and the content of the table fields before the database is imported, the PDO-> quote method is called for escape. The above error is reported on the php5.2.6 host, but it works normally on the 5.2.17 host.

When I just change the content to http://a.xxx /? Tid = 1, on the 5.2.6 and 5.2.17 machines are normal, so the content format again debugging as <a href = "http://a.xxx /? Tid = 1 "> test </a>, the performance of 5.2.6 and 5.2.17 is normal. It seems that it is a single quotation mark.

 

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.