Received: from wm.hub.org (wm.hub.org [200.46.204.128]) by postgresql.org (Postfix) with ESMTP id F18A29FB1F5 for ; Mon, 30 Oct 2006 00:32:37 -0400 (AST) Received: from maia (wm.hub.org [200.46.204.128]) by wm.hub.org (Postfix) with ESMTP id E710EDFA145 for ; Mon, 30 Oct 2006 04:32:37 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey- Received: from web51309.mail.yahoo.com (web51309.mail.yahoo.com [206.190.38.175]) by postgresql.org (Postfix) with SMTP id EB1E49FA2BA for ; Thu, 26 Oct 2006 15:11:52 -0300 (ADT) Received: (qmail 50050 invoked by uid 60001); 26 Oct 2006 18:11:47 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=ZKdGJn+V79AeNWhICpHtiqYdzMp74/N0WMfB5i7FMwGZ57xv8P4jU9mv1xzrsRlW80HFbt+kX6tpEGFNPfqcIDX3Jh44TRpBvCxAZnbOuieDe5GN6exqnDzr3YWWUqYWOOoHVNqvp2c+7KyOiY3H3rsCcuZ0qMw8CTNv1N7mEjM= ; Message-ID: <20061026181147.50048.qmail@web51309.mail.yahoo.com> Received: from [59.93.202.205] by web51309.mail.yahoo.com via HTTP; Thu, 26 Oct 2006 11:11:47 PDT Date: Thu, 26 Oct 2006 11:11:47 -0700 (PDT) From: Amal burman Subject: PostgreSQL locking from PHP scripts To: pgsql-php@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Archive-Number: 200611/7 X-Sequence-Number: 3625 Hello, I am unable to solve a locking problem. I am using postgresql database for this project. Here script one (booking.php) tries to setup a lock for update and ask user to fill-up the form. Now when the user fill-up the form and submit it for update, second script (update.php) update the database and releasing the locks. This is working for client (say) A and B from psql prompts but failed from PHP scripts. I have written following scripts as follows. booking.php ----------- ... $db=pg_pconnect($host,$database); // PostgreSQL database $sql_str="BEGIN; SELECT * FROM seat WHERE seat_no=1 FOR UPDATE NOWAIT"; ...
// collecting user's input ... update.php ---------- ... $db=pg_pconnect($host,$database); $sql_str="UPDATE seat SET status='booked' WHERE seat_no=1; END"; ... // end My update script failed to do lock the table and records. How I can fix it? One WARNING is showing by PostgreSQL, "there is no tranaction in progress". Thanks for your help in advance. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com