What is PDO? A PHP class with functions to make safer database connections.

What you will learn

UNDERSTAND what VANILLA PDO functions already do and stop using legacy code that is confusing you.

Gain a SOLID FOUNDATION to take other courses involving PHP and database connections.

Learn how to practice new code concepts in the world of code automation

The minimalist presentation facilitates your reviewing over time

Description

Why is PDOΒ important?

PDO provides a data-access abstraction layer in PHP, which means that, regardless of what database you’re using, you write the same functions to issue queries and fetch data.Β  It’s that simple! However, you still need to set a database-specific PDO driver in your php.ini to access the correct database server.

How is this course different?

  • This is a hands-on project; no fluff or history lessons that you can always search if you’re interested.
  • This updated course was originally written in 2019 using PHP 7.3,
    but it has been reviewed in 2023 using PHP 8.2 to assure its integrity.
  • Each section starts with independent code after a brief review of concepts.
    Wash, Rinse, and Repeat.

Upon completion of this project, you should be able to:

  1. Summarize and remember the steps involved in using PHP to accomplish a basic database connection and CRUD.
  2. Have a solid foundation to take other courses involving PHP and database connections, like using Symfony components, for example.
  3. Your PDO training starts here.

The purpose of this short course is to empower you by giving you the basics before you tackle a framework where everything is more abstract. It’s a short study project designed to go slow by repeating core exercises.


Get Instant Notification of New Courses on our Telegram channel.

Noteβž› Make sure your π”ππžπ¦π² cart has only this course you're going to enroll it now, Remove all other courses from the π”ππžπ¦π² cart before Enrolling!


Why PHP?

In 2024, PHP still powers 76% of websites around the world. PHP has evolved into a powerful, object oriented language. We are not in 2005 anymore.Β  The job market is wide open for good PHP developers that take time to study fundamentals.

This project informs and teaches; and that is great for reviewing concepts as well.

Add it to your collection of periodic drills you must do to stay current with the basics.

Subscribe today, even if you want to start at a later date.

English
language

Content

Introduction

How to do the exercises
What is PDO?
About your development environment
Creating a database with phpMyAdmin

Connect

Making a database connection using PDO
Using individual variables to hold credential values
Using a try catch statement to handle PDO connection errors
Discussed code and resources

Query and display results

Creating a new database connection
The two PDO methods for querying a database
Extracting data from the POD Statement
Discussed code and resources
Converting special characters to HTML entities
Review – Things to know
Moving SQL statements to variables
Discussed code and resources

Prepare and execute

Creating a new connection for prepared statements
Stage 1: Preparing the query
Stage 2: Executing the query – rowCount
Discussed code and resources
Named placeholders
Replacing query for execute. Running multiple executes
Discussed code and resources

Insert

Create a new connection file named dbinsert
Initial Code
Inserting a new record with Prepared Statements
Discussed code and resources
Displaying the number of affected rows
Displaying content from the last inserted id
Preparing output with HTML entities
Discussed code and resources

Update

Initial code for this session
SQL UPDATE with Prepared Statements
Final code for this session

Delete

Initial Code
Deleting a record with Prepared Statements
Final code for this session

Odds & ends

Including a single credential on multiples files
Hiding a folder from the browser
Resources for this section
Fetch arguments
Final code and resources
ATTR_EMULATE_PREPARES and bindValue (part 1)
Initial code
ATTR_EMULATE_PREPARES and bindValue (part 2)
Final code and resources
Bibliography

Thank you

Thank you