Special offers now — see discounted courses.
day
:
hour
:
min
:
sec
See special offers
PHP: Accessing Databases with PDO and MySQLi

PHP: Accessing Databases with PDO and MySQLi

3h 48mAdvanced2014-07-07

Authors

David Powers

David Powers

Developing websites since 1994

Course details

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.

Learning objectives
Connecting to a database with PDO or MySQLi
Fetching a result set
Executing simple non-SELECT queries
Sanitizing user input
Binding input and output values
Passing an array of values to the execute() method
Working with advanced PDO fetch methods
Executing a MySQLi transaction
Freeing resources that are no longer needed
Submitting multiple queries
Creating an instance of a class from a result set

Skills covered

PHPDatabase DevelopmentDatabase ManagementProgramming LanguagesOpen SourceSoftware DevelopmentDeep Dive (X:Y)

Concepts

0. Introduction

  • 01 - Welcome
  • 02 - What you should know before watching this course
  • 03 - Using the exercise files
  • 04 - Setting SQLite permissions
  • 05 - A quick primer on using PHP objects

1. Why Use Object-Oriented PHP to Access a Database

  • 06 - Overview of PHP database APIs
  • 07 - Using prepared statements
  • 08 - Using transactions

2. PHP Data Object (PDO) Basics

  • 09 - Creating a database source name
  • 10 - Connecting to a database with PDO
  • 11 - Looping directly over a SELECT query
  • 12 - Fetching a result set
  • 13 - Finding the number of results from a SELECT query
  • 14 - Checking if a SELECT query contains results
  • 15 - Executing simple non-SELECT queries
  • 16 - Getting error messages
  • 17 - Using the quote() method to sanitize user input

3. PDO-Prepared Statements and Transactions

  • 18 - Binding input and output values
  • 19 - Using named parameters
  • 20 - Using question marks as anonymous placeholders
  • 21 - Passing an array of values to the execute() method
  • 22 - Binding results to variables
  • 23 - Executing a transaction
  • 24 - Closing the cursor before running another query

4. Advanced PDO Fetch Methods

  • 25 - Generating an array from a pair of columns
  • 26 - Setting an existing object's properties with a database result
  • 27 - Creating an instance of a specific class with a database result
  • 28 - Reusing a result set

5. MySQL Improved Basics

  • 29 - Connecting to a database with MySQLi
  • 30 - Setting the character set
  • 31 - Submitting a SELECT query and getting the number of results
  • 32 - Fetching the result
  • 33 - Rewinding the result for reuse
  • 34 - Handling non-SELECT queries
  • 35 - Getting error messages
  • 36 - Sanitizing user input with real escape string()

6. MySQLi Prepared Statements and Transactions

  • 37 - Initializing and preparing a statement
  • 38 - Binding parameters and executing a prepared statement
  • 39 - Binding output variables
  • 40 - Executing a MySQLi transaction
  • 41 - Dealing with commands out of sync in prepared statements

7. Diving Deeper into MySQLi

  • 42 - Buffered and unbuffered queries
  • 43 - Using real query()
  • 44 - Freeing resources that are no longer needed
  • 45 - Submitting multiple queries
  • 46 - Creating an instance of a class from a result set

Conclusion

  • 47 - PDO and MySQLi compared

Related courses

Related learn paths

About us

LyndaKade is a leading learning platform that helps people learn business, software, technology, and creative skills to achieve personal and professional goals.

Phone numberAparat ChannelTelegram SupportTelegram ChannelInstagram Page

All rights to this site belong to LyndaKade.

Terms of Service|Privacy Policy

نماد الکترونیک enamad در صورت اتصال با آی‌پی داخل کشور، نمایش داده خواهد شد.
logo-samandehi - لوگو ساماندهی
zarinpal
zibal