课程: PHP with MySQL Essential Training: 1 The Basics
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Find a single record
- In the previous chapter, we learned to use PHP to retrieve data from the database. In this chapter, we're going to learn how to use those skills to perform each part of the database CRUD. Remember, that's create, read, update, and delete. And we'll begin by learning to find a single record. So far, we've been querying the database for a list of subjects, but now we want to find only a single subject or a single record from the database. The process is similar, but there are a few key differences. It's still going to use an SQL select query, just like we did when finding the list of subjects. But it's not the same as getting back that full list because we want to limit the results to only a single subject. And we find that subject by using a where clause with our select and then using the primary key to find the record that we want. Remember the primary key is the unique identifier for each record. In our case, the primary key is ID, and that's pretty standard. So we would need the…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。