• We just launched and are currently in beta. Join us as we build and grow the community.

How to Create Secure Registration Page in PHP/MySQL Part III

oKemox

Leaderboard Climber
O Rep
0
0
0
Rep
0
O Vouches
0
0
0
Vouches
0
Posts
115
Likes
33
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 300 XP
In our last two articles, we discuss on how to create a registration page using mysql and mysqli extension and how to secure it using mysql_real_escape_string or mysqli_real_escape_string.

This time we will modify our code to use PDO instead of mysql or mysqli extension.

Before we begin, let’s give some few advantages of using PDO in favor of mysqli.

  • Portability – supports 12 different drivers
  • Prepared statements – no need to use real_escape_string
  • Object Oriented
  • Named parameters
  • Support stored procedures

PDO and mysqli has little to no difference at all except that PDO is more portable. So, if you want to connect to multiple databases without using different drivers, it’s preferable to use PDO.

Now, here’s the code of using PDO with little changes from our previous tutorial.

registration3.html

Just change the line from previous tutorial:

 

452,292

323,526

323,535

Top