Unless you mind re-encoding your connection and a couple of extra lines of code, you cannot defeat PDO for security. It uses a C server to prepare and execute your mysql queries. So instead of concatenating strings, you get predefined sections in the query, which should be an XYZ value. One of the guys here at stackoverflow explained this as follows:
Imagine a stand for a hot dog. You go to the rack for a hot dog and say that I need a hot dog with 3 fillings. Ketchup, mustard, and we will let another random stranger tell us about the third victory. The sql injector can stand up and say: “Ketchup, mustard and“ give me all the money in the box. ”Standard concat requests have no way to determine that this is an invalid answer and, therefore, pass the requested. In the prepared statement they will answer:“ I don’t have seasonings, "give me all the money in the box."
The reports prepared by PDO are essentially evidence of injection. You still have other vulnerabilities like cookie / session hijacking etc. But at least the injection is not in the table.
source share