Table Locking?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
mccommunity
Forum Commoner
Posts: 62
Joined: Mon Oct 07, 2002 8:55 am

Table Locking?

Post by mccommunity »

I am doing an insert into a table. I need to lock the table before I do this insert so no one else can write to it while I am. how would I do this?


// This does an insert into the events table
$query = "INSERT INTO events (house,type,event_date,event_timestamp) ";
$query .= "VALUES ($event[FacId],4,'$event_date','$event[EventStartDateTime]');";
$result = pg_exec($con,$query);
User avatar
xisle
Forum Contributor
Posts: 249
Joined: Wed Jun 25, 2003 1:53 pm

Post by xisle »

run this as a query
LOCK TABLES table1 READ, table2 WRITE;

http://www.mysql.com/doc/en/LOCK_TABLES.html
Post Reply