Understanding PHP Data Objects (PDO)

Learn to use the PDO library to access databases using PHP
4.4 (12 ratings) Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
338 students enrolled
$50
Take This Course
  • Lectures 17
  • Contents Video: 1.5 hours
    Other: 0 mins
  • Skill Level Beginner Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works

Discover

Find online courses made by experts from around the world.

Learn

Take your courses with you and learn anywhere, anytime.

Master

Learn and practice real-world skills and achieve your goals.

About This Course

Published 6/2014 English

Course Description

The course teaches PHP Data Objects (PDO), the preferred way to connect to databases within PHP. It covers connecting to the database, and using all the features required to build fast, scalable applications that use a database connection. It covers essential concepts like security, and best practices with using the data retrieved from the database.

While a basic knowledge of PHP is recommended for this course, both beginners and experienced web developers will gain a complete understanding of how PHP Data Objects work.

A basic knowledge of PHP is recommended for this course. You will need to be able to open and write to a basic PHP file and be able to have a server and database installed. This course will use MySQL server.

Exactly What Is PDO?

The PHP Data Objects (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. 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 database server.

PDO provides a data-access abstraction layer, which means that, regardless of which database you're using, you use the same functions to issue queries and fetch data. PDO does not provide a database abstraction; it doesn't rewrite SQL or emulate missing features. You should use a full-blown abstraction layer if you need that facility.

What are the requirements?

  • Will require a webserver (Apache or Nginx) with PHP 5.1 or greater, and MySQL installed. Students will also require database management software such as Sequel Pro (Mac), HeidiSQL (Windows) or MySQL workbench (Linux).

What am I going to get from this course?

  • Work with MySQL and other database software from PHP including connecting, inserting, updating records, displaying database records in lists within HTML and database security.

What is the target audience?

  • Anyone with basic knowledge of PHP, database experience not required but is helpful, as this is demonstrated.

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.

Curriculum

Section 1: Introduction
05:45

Download the course files here.

Section 2: Understanding PHP Data Objects (PDO)
03:05

Explains how to list the available database drivers installed on the system that can be used with PDO

04:12

Setting up an example database, explaining each column and inserting some example records that we can use throughout the series.

08:40

Using PHP to connect to the database and checking what we can do if a connection fails

06:28

Setting error levels for PDO, so we can check for errors in different ways.

Section 3: Fetching Results
05:02

Sending a basic query to the database server.

08:57

Fetching a list of results from our database table, and examining the data we receive

05:02

Looping over results so we can display them in a list or modify them. We use some HTML to display results to a user on a page.

05:15

Showing an easier way to fetch all results using one method so we don't need to loop over each row

08:16

Fetching results as an object, so we can work with data in true object oriented style and make our application clean and the data easier to work with.

06:56

Getting the count of rows in the results so we can either display the amount of results we have, or use this number for later calculations.

Section 4: Hands On Project: User Class Dates
09:51

A small side project, creating a PHP class to represent a user in the system, which allows us to implement methods (functions) for each user we get back. This keeps our application DRY (do not repeat yourself) and much easier to work with, saving time in the future.

Section 5: Security
07:27

A look at security, and escaping data before we use it in our database queries, to help prevent against SQL injection.

06:18

Prepared statements that help query with large amounts of user data and more importantly automatically protect against SQL injection without having to manually escape each peice of data.

Section 6: Inserting
07:14

Inserting new records into the database.

04:01

Getting the last inserted ID of the record so we can perform future queries using the last record as a reference.

Request a Course
Article

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Stone River eLearning, 180,000+ Happy Udemy Students | 320,000+ Students Worldwide

At Stone River eLearning, technology is all we teach. If you're interested in programming, development or design - we have it covered. 

Check out our huge catalog of courses and join the over 320,000 students currently taking Stone River eLearning courses. We currently offer 125+ different technology training courses on our Stone River eLearning website and are adding new courses on hot and trending topics every month. A subscription option is available for those with a real passion for learning.

Ready to start learning?
Take This Course