PHP PDO MySQL: simple example of connecting to MySQL with PDO class
I’ll demonstrate a simple example on how to connect to MySQL using PHP’s PDO class. Just some of the benefits of PDO are that it’s fast and if you use the PDO::prepare() method, you’ll avoid SQL injection attacks by calling the PDO::quote() method. The other advantage is that it supports multiple databases. So let’s dive…