In this video, you will examine why it can be helpful to have a form for deleting records with a POST request, and then create a form and construct an SQL DELETE statement and send it to the database.
- [Instructor] Throughout this chapter,…we've been learning to implement CRUD in PHP…and we've learned the first three of those.…Create, Read and Update.…In this movie, we're going to learn how to Delete records.…First, let's refresh our memory…about what an SQL Delete Statement looks like.…You see we have 'DELETE FROM'…and then the table we want to use to delete from…and then 'WHERE id = 1'.…We don't need to provide any data to deleting,…we just have to have a condition…telling it which record or records…should be deleted.…You can use delete to delete multiple records at a time…but most of the time when we're working with CRUD,…we're going to be deleting a single record at a time.…
We'll want to specify the primary key, like we do here.…We'll construct our SQL Delete Statement…and we'll pass that in to MySQLi Query.…Remember that when we're deleting a single record,…it's going to require that we know…what subject id we have so we're going to want to pass that in,…make sure we have access to that…so we can construct our where clause with it.…
- Organizing project files
- Including and requiring files
- Working with URL parameters
- Encoding dynamic content
- Modifying headers and page redirection
- Creating forms and processing form data
- MySQL basics
- Using PHP to access database tables
- Creating, reading, updating, and deleting database records with PHP
- Validating data
- Preventing SQL injection
Skill Level Beginner
1. Start a Database-Driven Project
2. Build Web Pages with PHP
3. Headers and Redirects
4. Build Forms with PHP
5. MySQL Basics
6. Use PHP to Access MySQL
7. CRUD with PHP
8. Validate Data with PHP
9. Prevent SQL Injection
Next steps1m 8s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.