pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amal burman <amalburman@yahoo.com>
To: pgsql-php@postgresql.org
Subject: PostgreSQL locking from PHP scripts
Date: Thu, 26 Oct 2006 11:11:47 -0700 (PDT)
Message-ID: <20061026181147.50048.qmail@web51309.mail.yahoo.com> (raw)

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";
...
<FORM method="get" action="update.php">
// 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 




view thread (12+ messages)  latest in thread

Message-ID: <20061026181147.50048.qmail@web51309.mail.yahoo.com>
Permalink:  ../20061026181147.50048.qmail@web51309.mail.yahoo.com/
Also on:    postgresql.org/message-id/20061026181147.50048.qmail@web51309.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: amalburman@yahoo.com
  Subject: Re: PostgreSQL locking from PHP scripts
  In-Reply-To: <20061026181147.50048.qmail@web51309.mail.yahoo.com>
  References: <20061026181147.50048.qmail@web51309.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox