Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the PDO version problem Invalid parameter number: no parameters were bound

Shulou Source: shulou.com Published: 2022-06-03 01:06:39 12月06日 Update

This article focuses on "how to solve the PDO version problem Invalid parameter number: no parameters were bound", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn how to solve the PDO version problem Invalid parameter number: no parameters were bound!

Today, I found a very strange problem when dealing with bug. When performing certain operations, it will be reported: Invalid parameter number: no parameters were bound, but the problem has not been reproduced locally or on the test machine. I wondered if it had anything to do with the version, so I went to google and found that the second floor of the http://forum.typecho.org/topic.php?id=1501 article said that the problem is the version of bug, which will appear in the pdo below php5.2.9. So I found another simultaneous machine on the team (5.2.6) to do the test, and sure enough, the problem was reproduced, and it was tested on 5.2.17 on his server, and the problem did not appear.

When debugging, it is found that when this kind of operation occurs, the following business reports the above error:

Use PDO to insert a piece of data into the table nw_log (table fields, columns such as uid, and content fields), where the content of the content field is test, and the contents of the table field are escaped by calling the PDO- > quote method before entering the library. The above error is reported on the php5.2.6 machine, but the performance is normal on the 5.2.17 machine.

When I just changed the content to http://a.xxx/?tid=1, it worked well on both 5.2.6 and 5.2.17 machines, so I debugged the content format to test again, and it was normal on 5.2.6 and 5.2.17, which seems to be caused by single quotes.

At this point, I believe you have a deeper understanding of "how to solve the PDO version problem Invalid parameter number: no parameters were bound". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Tags: Problem content version time machine field test method error learning practical deeper table above business second floor interest again just at the same time team Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Technology MySQL Shulou Tech Info MariaDB Huawei