Chapter 8. Writing to Web Databases

Many web database applications are not only information resources for users but also tools for storing new information. For example, in an online store, users and administrators write data to the database in several situations: they can purchase products by creating an order, they can become members, they can manage a shopping cart, and the administrator can manage the stock.

Writing data in web database applications requires different techniques from reading data. Issues of transactions and concurrency become important, and we introduce these issues and the principles of dealing with them in this chapter. The introduction is practical: we focus on the basic management techniques of locking and unlocking tables, and show you how to safely implement simple database writes in MySQL when there is more than one user simultaneously accessing a database. Most importantly, we identify when special approaches are required, and when these can be safely omitted from a web database application.

At the conclusion of this chapter, you will have covered the skills to build a simple but complete web database application.