PHP Data Objects (PDO)
In this content you will learn how to configure the Microsoft SQL Server Database connection driver and create a connection to this database using PHP Data Objects (PDO) and the PHP language.
To understand how a connection using PDO works, look at Figure 1:
The PDO extension defines a lightweight and consistent interface for accessing databases in PHP. Each database driver that implements it can use methods for communicating with the Database. Note that you cannot perform any database functions using the PDO extension by itself: You must use a database-specific PDO driver to access a server.
PDO provides a data access abstraction layer, which means that regardless of the database you are using, the functions for issuing queries and fetching data are the same. PDO does not provide a database abstraction, meaning it does not rewrite SQL or simulate missing features. You must use a full abstraction layer if you need this facility.
See Figure 2 for the drivers implemented in the PDO.
See how we will use the connection class and make a query bringing some information from the Database: