Viewers: in countries Watching now:
Now that PHP has true object-oriented capabilities, it's best practice to access databases using PDO (PHP Data Objects) and MySQLi. These methods produce database-neutral code that works with over a dozen systems, including MySQL, SQL Server, PostgreSQL, and SQLite. Learn how to use PDO and MySQLi to perform basic select, insert, update, and delete operations; improve security with prepared statements; and use transactions to execute multiple queries simultaneously. Author David Powers also covers advanced topics like instantiating custom objects, and compares PDO to MySQLi so you can decide which method is right for you.
This course focuses on accessing databases with PHP. So you should already have a good handle on the basics of PHP and SQL or structured query language, the main language for communicating with a relational database. We'll be using built in PHP classes so you don't need to be an expert on object oriented PHP. If you've never worked with PHP objects before, watch the quick primer on using PHP objects at the end of this chapter, it contains all the information you need to know.
In terms of physical requirements, all you need is a web server running PHP 5.3 or later. I'll b using a local testing server but you can use a remote web server if you prefer. The first part of the course covers PDO, which is database neutral. So, you don't even need a database. The exercise files contain a standalone data file built using SQLite 3. All communication with the data file is done through PHP. So, there's no need to install SQLite on your own system.
The second half of the course is specific to MySQL. So you'll need a recent version of MySQL to follow chapters five, six, and seven. Alternatively, you may use MariaDB, which some Linux distributions are now using as a replacement for MySQL. MariaDB is developed by members of the original MySQL team, and is designed to be fully compatible. To load the data into MySQL or MariaDB, you might find it easier to use a graphical front end, such as phpMyAdmin.
If the course sounds as though it might be beyond your current skills, there are plenty of other courses here on lynda.com that will get you up to speed. My Introducing PHP lays the foundations of writing PHP scripts. For a refresher on structured query language check out SQL Essential Training with Bill Weinman. And for MySQL-specific help, take a look at Up and Running with MySQL Development with Sheeri Cabral.
There are currently no FAQs about Accessing Databases with Object-Oriented PHP.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.