Hi,
Is there an elegant way to recover from DB errors in MySQL using PHP, i.e.
transactions and rolling back - basically I have an insert statement then an update
statement. if the insert succeeds the update is run but if the update fails I want to
undo the insert!
Any suggestions, I guess I
I believe you can use transactions with InnoDB tables on MySQL, if this
is the case, a simple BEGIN; to begin your transaction, and a
COMMIT; to save all the changes, plus a ROLLBACK; to undo your
changes, should be sufficient.
On Mon, 2004-03-29 at 13:12, Matthew Oatham wrote:
Hi,
Is there
Matthew Oatham wrote:
Hi,
Is there an elegant way to recover from DB errors in MySQL using PHP,
i.e. transactions and rolling back - basically I have an insert
statement then an update statement. if the insert succeeds the update
is run but if the update fails I want to undo the insert!
Matthew Oatham wrote:
Is there an elegant way to recover from DB errors in
MySQL using PHP, i.e. transactions and rolling back -
basically I have an insert statement then an update
statement. if the insert succeeds the update is run
but if the update fails I want to undo the insert!
Use
Though I know there are many people out there who cringe at the thought
of using DB abstraction layers, I really like ADOdb and it has very nice
transaction support built in (as long as the underlying database
supports it, obviously).
I don't know why people hate them sothey make life so
yup - use transactions.
http://www.mysql.com/doc/en/COMMIT.html
--- Matthew Oatham [EMAIL PROTECTED] wrote:
Hi,
Is there an elegant way to recover from DB errors in
MySQL using PHP, i.e. transactions and rolling back
- basically I have an insert statement then an
update statement. if the
Is there anyway to do something similar to Transactions in mysql?
--
--
Diana Castillo
Global Reservas, S.L.
C/Granvia 22 dcdo 4-dcha
28013 Madrid-Spain
Tel : 00-34-913604039
Fax : 00-34-915228673
email: [EMAIL PROTECTED]
Web : http://www.hotelkey.com
http://www.destinia.com
--
PHP
Is there anyway to do something similar to Transactions in mysql?
Yes, use transactions
http://www.mysql.com/doc/en/Transactional_Commands.html
-Craig
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Is there anyway to do something similar to Transactions in mysql?
Yes -- http://www.mysql.com/doc/en/ANSI_diff_Transactions.html
--
Lowell Allen
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Diana Castillo wrote:
Is there anyway to do something similar to Transactions in mysql?
Maybe the transaction section of the MySQL manual will help you out?
http://www.mysql.com/doc/en/Transactional_Commands.html
--
By-Tor.com
It's all about the Rush
http://www.by-tor.com
--
PHP General
Hi. I thought I had abstracted out the SQL querying part of my code out,
just to find out today that it doesn't work when it comes to
transactions. I had come up with this code:
function sql_query($sql) {
$conn = pg_connect(dbname=JC user=postgres);
$res = pg_exec($conn, $sql);
if
Not exactly sure why your transactions aren't working but if your script
already has an open connection to the database and you issue another
call to pg_connect with the same connect string PHP will return the
existing connection and should not create another connection to the
database, that is
Jason Sheets wrote:
Manual Excerpt: If a second call is made to pg_connect() with the same
connection_string, no new connection will be established, but instead,
the connection resource of the already opened connection will be
returned. You can have multiple connections to the same database if
Jean-Christian
If you are only doing an insert then you do not need the transactions
BEGIN and COMMIT because that is already done for you on a single
insert. PGSQL is transaction based so if it does not go then it will not
work.
-Ray
On Thu, 2003-01-09 at 22:23, Jean-Christian Imbeault wrote:
You could try leaving off the ;...
Try $sql = BEGIN
Try $sql = COMMIT
That should work...
On Thu, 2003-01-09 at 22:23, Jean-Christian Imbeault wrote:
Jason Sheets wrote:
Manual Excerpt: If a second call is made to pg_connect() with the same
connection_string, no new connection will
To all who replied to my initial question ...
I actually did *not* have problems with transactions in the way I first
implemented my abstraction layer. In the case of PHP
If a second call is made to pg_connect() with the same
connection_string, no new connection will be established, but
look at the syntax for locking the tables.
Curtis
- Original Message -
From: "Christian Dechery" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Sunday, February 11, 2001 7:14 PM
Subject: [PHP] transactions
Hi,
I was reading mysql's manual, about transactions and all... an
17 matches
Mail list logo