Using PDO::quote with Parameterized Queries

Posted: May 10, 2011  0 comments  

Average Rating

Tags
PDO
security
SQL Server Driver for PHP
I spent some time last week investigating a puzzling issue raised in the SQL Server Driver for PHP forums: Need help with PDO::quote() and PDOStatement::bindValue and PDO::execute using new SQLSRVR 2.0 driver . At the heart of the issue was this question: Should you use the PDO::quote method to quote a parameter if you are also using the PDOStatement::bindValue or the PDOStatement::bindParam method to bind the parameter? My answer is no, you shouldn’t. I’ll explain why not, but I wonder if I’m potentially missing some use cases where it does make sense…I’d be very interested to learn those cases if I am. The PDO::quote method is intended to appropriately quote a string and escape special characters (appropriate Read More...

View the original post

Submit a Comment

  • Plain text is accepted.
  • URLs starting with http:// are converted to links.