Page 1 of 1

Table Locking?

Posted: Tue Jan 27, 2004 11:36 am
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);

Posted: Tue Jan 27, 2004 12:54 pm
by xisle
run this as a query
LOCK TABLES table1 READ, table2 WRITE;

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