Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 2. Databases > PHP Database Objects

2.4. PHP Database Objects

If you’ve used PHP with MySQL before, you may have used the mysql or mysqli libraries to connect to your database, using functions such as mysql_connect(). For many years, this was a standard way of connecting to MySQL databases, and there were equivalents for other database platforms.

These libraries were used directly and formed the basis of libraries and frameworks for countless PHP applications. The disadvantage was that each extension differed slightly from the others, so making code that could easily move between database platforms was tricky. Although those database-specific libraries are still active and well-maintained, this chapter will focus on using the more modern PDO extension. The PDO extension was created to give us a unified set of functionality when talking to database platforms of all kinds. It’s an object oriented extension that was introduced with PHP 5, taking advantage of many features introduced into the language at that time.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial