DEV Community

Cover image for Parameter Binding in PHP – Examples and Discussion
Aritra Mukherjee
Aritra Mukherjee

Posted on • Originally published at geekyminds.co.in on

Parameter Binding in PHP – Examples and Discussion

🎯 In this article, we are going to look into four basic examples of Parameter Binding in PHP using both MySQLi and PDO! I have accumulated these from my own projects and various corners of the web. They will help you get started with Parameter Binding in PHP if you happen to find to it tricky to use, just like I did.

💡 If Parameter Binding does not tell you anything, you may want to check out my previous article where I explained how Parameter Binding can be used for deterring most SQL Injection attacks in PHP.

Just like the previous article, I am going to show you how to use both MySQLi and PDO step by step. This way, people who are comfortable with MySQLi will be able to learn PDO easily and vice versa.

Here's what I'll cover:

  • Creating the MySQLi and PDO Objects
  • Example 1: Single Parameter Binding
  • Example 2: Mulitple Parameter Binding
  • Example 3: Reusing Query with Parameter Binding
  • Example 4: Implementing Basic Search With SQL LIKE

Continue reading "Parameter Binding in PHP – Examples and Discussion"

The post Parameter Binding in PHP – Examples and Discussion appeared first on GeekyMinds.

Top comments (0)