PHP Data Objects, also known as a PDO, is a standardized, lightweight, interface used for accessing multiple databases. PDO’s were introduced in PHP 5.1, as a replacement of MySQL or MySQLi extensions, in order to help uniform database connectivity and eliminate the headache of switching between database management systems (DMS). Previously PHP programmers were forced to use database specific functions which made switching between, for example, a MySQL database and an Oracle database very difficult. With the introduction of PDO’s, programmers no longer need to rewrite there code (as functions remain the same no matter what database they are using), they can simply change there connection string and immediately begin accessing new data.
A major advantage of a PDO is that it comes with a library of secure database interactions; such as prepared statements. Prepared statements are sort of like templates for code, you set them up for heavily used statements, and then you can execute them over and over again eliminating the need to rewrite the code. Prepare statements not only save programmers time, but they also protect against harmful SQL injections which are used to attack data-driven applications. With a growing popularity in dynamic websites, and applications, data driven development is at an all time high. PDO’s help fill the need for a more secure data accessing system and helps make the development process a little less painful.comments powered by Disqus