开发者

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

If I write a script php writing 开发者_JAVA百科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 ?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜