aneuryzm
aneuryzm

Reputation: 64834

how to handle multi-users connections with my php script?

If I write a script php writing in a database,
should I handle the locking of the database to avoid conflicts between users ?

Or is this issue handled by the web server ?

Upvotes: 0

Views: 139

Answers (2)

Marcus Adams
Marcus Adams

Reputation: 53840

Locks are handled implicitly by MySQL. You generally don't have to worry about issuing the actual lock statements, but you must be aware of how your updates are affecting other users.

InnoDB supports row level locking, so updates may be unobtrusive, assuming you're using a primary key.

Upvotes: 2

stecb
stecb

Reputation: 14746

Sure you have to handle it ;)! For example you could use the "LOCK TABLE myTable WRITE" statement to prevent conflicts. When the user has released (throuh "UNLOCK TABLE") the resource, another user can operate with that table

Upvotes: 0

Related Questions