Re: lock a record of MySQL from PHP
| From: | Miles Thompson | Date: | Fri, 27 Sep 2002 12:22:17 +0000 |
| Subject: | Re: lock a record of MySQL from PHP | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-22049@lists.php.net to get a copy of this message | ||
1. Check MySQL syntax for locking a record
2. Build the query to do that, assigning it to something like $qry
3. mysql_query( $qry )
4. Check for results
HOWEVER - given that the web is a stateless environment, and a user can just close a browser, or walk away, or whatever, are you SURE you want to lock a record? An awful lot of db work can be done w/o express locking of records. You get an implicit lock on an UPDATE or INSERT.
I've not checked the MySLQ docs, but the classic way to see if a record is locked is to attempt a lock. I'd suggest reading up on the pro's and con's of locking, either in the MySQL docs or in a general book on SQL.
Hope this helps - Miles Thompson
At 12:11 PM 9/27/2002 +1000, Michael Wai wrote:
I'm a newbie of PHP and MySQL. Would anyone tell me that how to lock and unlock a record of MySQL from PHP? And how other can detect whether this record is locked or not? Thanks for your help. Regards, Michael Wai -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php