Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

YouTube

How to Connect a Form to a Database in PHP - PDO Tutorial

Dave Gray via YouTube

Overview

Save Big on Coursera Plus. 7,000+ courses at $160 off. Limited Time Only!
Learn how to connect a form to a database using PHP and PDO in this comprehensive tutorial. Explore the process of creating a PHP Data Object (PDO) to establish a connection between PHP forms and a MySQL database, enabling CRUD operations through Select, Insert, Update, and Delete statements. Follow along as the tutorial guides you through importing a sample database, setting up a PDO connection, creating forms, filtering input, executing SQL queries, and handling query results. Discover how to implement update and delete functionality, add confirmation messages, and apply CSS styling to enhance the user interface. While the initial code achieves the goal of connecting forms to a database, the tutorial also mentions a follow-up video that refactors the code using functions and the MVC Design Pattern for improved organization and professionalism.

Syllabus

Intro
A Note About Setup
Importing the World database
Creating the PDO Connection file
Creating the index page forms
Filtering Submitted Form Input
Building and Executing a SQL Select Query in PHP
Building and Executing a SQL Insert Query in PHP
Review the Logical Flow of the Application
Working with the results of the SQL Select Query
Creating the Update and Delete Forms
Reviewing the Logical Flow of the Application again
Creating the delete_record.php file
Creating the update_record.php file
A note about PHP files
Adding a confirmation to the index file
Reviewing the application in the browser
Testing and Debugging!
Adding CSS Styles
Discovering one more issue...and fixing it!
Finishing the CSS styling

Taught by

Dave Gray

Reviews

Start your review of How to Connect a Form to a Database in PHP - PDO Tutorial

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.