| From: | Amal burman <amalburman(at)yahoo(dot)com> |
|---|---|
| To: | pgsql-php(at)postgresql(dot)org |
| Subject: | PostgreSQL locking from PHP scripts |
| Date: | 2006-10-26 18:11:47 |
| Message-ID: | 20061026181147.50048.qmail@web51309.mail.yahoo.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-php |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Dirk Becker | 2006-11-01 18:36:36 | cant conect to dynamic host-URL |
| Previous Message | Marc McIntyre | 2006-10-19 11:37:06 | Re: plpgsql returning array |