Book Image

Twilio Cookbook: Second Edition

By : Roger Stringer
Book Image

Twilio Cookbook: Second Edition

By: Roger Stringer

Overview of this book

Table of Contents (20 chapters)
Twilio Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Why use PDO instead of the standard MySQL functions?


There are several ways to connect to a MySQL database in PHP. You can use mysql_* functions that have become deprecated, old, and slow. You can also use mysqli_* functions that are slowly replacing mysql_* functions; however, they are also slow.

PDO stands for PHP Data Objects; it recently replaced the original MySQL library for the purpose of talking to databases. It also has support for PostgreSQL and SQLite.

The PDO extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver that implements the PDO interface can expose database-specific features as regular extension functions.

PDO is also nice because it provides a data-access abstraction layer, which means that, regardless of the database you use, you employ the same functions to issue queries and fetch data.

The process we use to talk to our MySQL databases is a class called pdo.class.php. We use it to talk to our databases using the PDO...