PHP and MySQL
Writing to Web DatabasesPHP and MySQL - Writing to Web Databases
Writing to Web Databases
Database Inserts, Updates, and Deletes
Reloading Data and Relocation Techniques
Uploading and Inserting Files into Databases
Inserting, Updating, and Deleting Data
PHP DML functions for database modifications
Inserting data
Updating data
Deleting data
Issues in Writing Data to Databases
Transactions and Concurrency
Locking for Concurrency in MySQL
When and how to lock tables
The LOCK TABLES and UNLOCK TABLES statements in MySQL
Locking for performance
Locking Tables in Web Database Applications
Locking methods that don't work in web database applications
Locking with an auxiliary table
The table-level locking paradigm in MySQL
Other locking paradigms
What isn't covered here
Writing data in web database applications requires different techniques than reading data. Issues of transactions and concurrency become important, and we introduce these issues and the principles of dealing with them in this tutorial. The introduction is practical: we focus on the basic management techniques of locking and unlocking tables, and 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.