Home  >  Article  >  Backend Development  >  PDO version problem Invalid parameter number: no parameters were bound_PHP tutorial

PDO version problem Invalid parameter number: no parameters were bound_PHP tutorial

WBOY
WBOYOriginal
2016-07-21 15:13:451226browse

I found a very strange problem when dealing with bugs today. When performing certain operations, it will report: Invalid parameter number: no parameters were bound. However, the problem has not been reproduced locally or on the test machine. , I guessed whether it was related to the version, so I googled it and found http://forum.typecho.org/topic.php?id=1501 The second floor of the article said that the problem is a version bug, which is below php5.2.9 will appear in the pdo. So I found another machine (5.2.6) in the team to do the test, and the problem was indeed reproduced. When I tested it on 5.2.17 on his server, the problem did not appear.

During debugging, it was found that the following business reported the above error when this type of operation occurred:

Use PDO to the table nw_log (table fields such as uid and content fields) Insert a piece of data in the content field, where the content of the content field is test, and the content of the table field will call PDO before entering the database. ->quote method for escaping. On the php5.2.6 machine, the above error is reported, but on the 5.2.17 machine it behaves normally.

When I just modified the content to http://a.xxx/?tid=1, it behaved normally on both the 5.2.6 machine and the 5.2.17 machine, so I formatted the content again When debugging as test, the performance is normal on 5.2.6 and 5.2.17. It seems to be caused by single quotes. .

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326401.htmlTechArticleI found a very strange problem when dealing with bugs today. When performing a certain type of operation, it will report: Invalid parameter number: no parameters were bound, but the problem is local or...
Statement:
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