CRUD stands for:

Create
Read
Update
Delete

These are the for minimum operations that you need to support and understand for databases.

The first two are covered in chapter 18, with example code for how to use insert and select.

Update just requires you to use mysqli_query with an SQL update statement.
Delete just requires you to use a mysql_query with a SQL delete statement.

Create is usually used to add one record a time to a database table from data supplied from a form the user has filled out. It is critical to use the mysql_real_escape_string function for security.

Read is most often used for two types of pages, a page that presents a list of row results, or a page that only presents one row result on the page.

Example of multiple row results are when you do a keyword search in amazon.com, it displays several products.

Example of only showing one recode on a page would be when you then select one of those projects to see details about it.

Update is most often used to update data in only one record of the database, this is used for example to update the data for your profile. To control only modifing one record, the update SQL statement will have a where clause with the record limited to a specific primary key value.

Delete is also most often used to delete only one record limited by a where clause on a primary key value.

We will see several examples of the CRUD pattern of code is used in the sample applications we will b looking at in the next topic.
Last modified: Monday, October 11, 2010, 1:21 AM