课程: PHP with MySQL Essential Training: 1 The Basics

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Use form data to update records

Use form data to update records

- [Instructor] In this movie, we'll learn to use submitted form data in order to update records in the database. First let's remind ourselves what an SQL update statement looks like, we have update and then table, and then we use set followed by each column and the value we want to provide for that column. That's different than what we did with an insert statement. Here, the columns and their values are paired up using equal signs with commas in between them. And then in this case, you can see them also providing WHERE ID equals one, because I'm targeting a specific row in the database for my update. So we'll be constructing an update query that looks like that and then we'll pass it in to mysqli query. SQL update can update multiple records at once, but usually for Crud, we're going to be targeting a single record. Like you just saw in that example. When we do that, we're going to need to make sure that we have a primary key so that we can identify the record. And the primary key…

内容