Basic Database Connection using PDO in PHP

In this tutorial we are going to learn  connecting to MySQL with PHP using PDO.

“PDO – PHP Data Objects – is a database access layer providing a uniform method of access to multiple databases.”

You don’t need to worry about different syntax for different database types, PDO will do this painless.

Did you notice the setAttribute function and the params, this will enable the error more on in your database connection,

Editorial Staff
 

Editorial Staff at tutsplanet is a dedicated team to write various tutorial articles.