[PHP-DB] apache/php/mysql - guarenteed DB transaction
Hi all. Question on running in a config with Apache2,PHP 4.3.4,MySQL 4.0.17 running on Linux Redhat 9.0. Basically I want to make sure that a DB insert or update is guarenteed to complete. So if a user hits submit on a webpage, the transaction under the hood completes, no matter if the user hits cancel or his browser dies or whatever. (Not sure how to even test this condition, but I know it will happen) Below is a sample of my PHP which does one thing, simple insert into mysql. I am using MyISAM table types, and would like to maintain this if possible. Any help or pointers would be greatly appreciated. David [EMAIL PROTECTED] ?php // mysqltest.php // Main Variables $dbhost = localhost; $dbuser = user; $dbpass = pass; $dbname = test; // open persistent DB connection $dbcnx = @mysql_pconnect($dbhost, $dbuser, $dbpass) or die(The site database appears to be down.); if ($db!= and [EMAIL PROTECTED]($db)) die(The site database is unavailable.); // Open DB Persistent Connection $dbcnx = dbPConnect(); // Execute check against database mysql_select_db($dbname, $dbcnx); // Create SQL $sql = INSERT INTO mytable SET field1='update to field1',field2='update to field2'; // // Execute SQL // $result = mysql_query($sql); // $result = 1 if success if ($result == '1') { echo Finished with DB insert; } else { echo Failed.; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction
snip So if a user hits submit on a webpage, the transaction under the hood completes, no matter if the user hits cancel or his browser dies or whatever. (Not sure how to even test this condition, but I know it will happen) /snip Once php has the request, hitting cancel on the browser or a browser dying will not stop the php script from executing all the way through. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction
On Wednesday 04 February 2004 23:46, Matt Matijevich wrote: Once php has the request, hitting cancel on the browser or a browser dying will not stop the php script from executing all the way through. Actually whether the script runs through to completion depends on the 'ignore_user_abort' setting. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-db -- /* I don't care who does the electing as long as I get to do the nominating. -- Boss Tweed */ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction
snip Actually whether the script runs through to completion depends on the 'ignore_user_abort' setting. /snip wow, guess you learn something everyday. wish I would have known about that when I wrote a php script with some terrible (lots of joins, just poorly designed) queries that took down my webserver :( -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] apache/php/mysql - guarenteed DB transaction
Thanks guys, this is great info. One last thought, Suppose I have several DB transactions that I want to treat as 1 logical transaction that I need to complete guarenteed. For instance, an INSERT to one table, and a DELETE to another, and an UPDATE to a third. All need to complete once a user selects submit. What's the best approach to this scenario? Thanks in advance for the help, David -Original Message- From: Matt Matijevich [mailto:[EMAIL PROTECTED] Sent: Wednesday, February 04, 2004 11:17 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction snip Actually whether the script runs through to completion depends on the 'ignore_user_abort' setting. /snip wow, guess you learn something everyday. wish I would have known about that when I wrote a php script with some terrible (lots of joins, just poorly designed) queries that took down my webserver :( -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] apache/php/mysql - guarenteed DB transaction
snip Suppose I have several DB transactions that I want to treat as 1 logical transaction that I need to complete guarenteed. For instance, an INSERT to one table, and a DELETE to another, and an UPDATE to a third. All need to complete once a user selects submit. What's the best approach to this scenario? /snip this is the pseudo code i would use: start the transaction INSERT DELETE UPDATE if everything is ok, commit, else rollback -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Res: [PHP-DB] apache/php/mysql - guarenteed DB transaction
Hi, I had a similar problem andI solved it using transations, but I had to use InnoDB table types... Regards, Ricardo ---Mensagem original--- De: whynotpizza Data: 02/04/04 15:33:37 Para: [EMAIL PROTECTED] Assunto: [PHP-DB] apache/php/mysql - guarenteed DB transaction Hi all. Question on running in a config with Apache2,PHP 4.3.4,MySQL 4.0.17 running on Linux Redhat 9.0. Basically I want to make sure that a DB insert or update is guarenteed to complete. So if a user hits submit on a webpage, the transaction under the hood completes, no matter if the user hits cancel or his browser dies or whatever. (Not sure how to even test this condition, but I know it will happen) Below is a sample of my PHP which does one thing, simple insert into mysql. I am using MyISAM table types, and would like to maintain this if possible. Any help or pointers would be greatly appreciated. David [EMAIL PROTECTED] ?php // mysqltest.php // Main Variables $dbhost = "localhost"; $dbuser = "user"; $dbpass = "pass"; $dbname = "test"; // open persistent DB connection $dbcnx = @mysql_pconnect($dbhost, $dbuser, $dbpass) or die("The site database appears to be down."); if ($db!="" and [EMAIL PROTECTED]($db)) die("The site database is unavailable."); // Open DB Persistent Connection $dbcnx = dbPConnect(); // Execute check against database mysql_select_db($dbname, $dbcnx); // Create SQL $sql = "INSERT INTO mytable SET field1='update to field1',field2='update to field2'"; // // Execute SQL // $result = mysql_query($sql); // $result = 1 if success if ($result == '1') { echo "Finished with DB insert"; } else { echo "Failed."; } ? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php IncrediMail - O mundo do correio eletrĂ´nico finalmente desenvolveu-se - Clique aqui
Res: RE: [PHP-DB] apache/php/mysql - guarenteed DB transaction
You should use set autocommit = 0; start transaction; insert code; delete code; update code; commit or rollback depending on the result; To do all this I had to use InnoDB table types. Sorry, my english is quite pour, Best regards, Ricardo ---Mensagem original--- De: whynotpizza Data: 02/04/04 20:39:13 Para: 'Matt Matijevich'; [EMAIL PROTECTED]; [EMAIL PROTECTED] Assunto: RE: [PHP-DB] apache/php/mysql - guarenteed DB transaction Thanks guys, this is great info. One last thought, Suppose I have several DB transactions that I want to treat as 1 logical transaction that I need to complete guarenteed. For instance, an INSERT to one table, and a DELETE to another, and an UPDATE to a third. All need to complete once a user selects submit. What's the best approach to this scenario? Thanks in advance for the help, David -Original Message- From: Matt Matijevich [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 04, 2004 11:17 AM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP-DB] apache/php/mysql - guarenteed DB transaction snip Actually whether the script runs through to completion depends on the 'ignore_user_abort' setting. /snip wow, guess you learn something everyday. wish I would have known about that when I wrote a php script with some terrible (lots of joins, just poorly designed) queries that took down my webserver :( -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php IncrediMail - O mundo do correio eletrĂ´nico finalmente desenvolveu-se - Clique aqui
[PHP-DB] Apache+PHP+MySQL installation at once - HOW?
Hi, I want to install this great trio Apache+PHP+MySQL and don't want it install step by step, program by program. I remember, that I saw somewhere some prepared package for very fast and comfortable installation of these three at once. Don't you now where I can find it? Thanks Vojtech -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Apache+PHP+MySQL installation at once - HOW?
I remember, that I saw somewhere some prepared package for very fast and comfortable installation of these three at once. Don't you now where I can find it? Thanks I think you wanna be going to: http://www.phpgeek.com/phptriad.php Good luck! Russ. On Fri, 4 May 2001 09:45:41 +0200 Vojtech Dvorak [EMAIL PROTECTED] wrote: Hi, I want to install this great trio Apache+PHP+MySQL and don't want it install step by step, program by program. I remember, that I saw somewhere some prepared package for very fast and comfortable installation of these three at once. Don't you now where I can find it? Thanks Vojtech -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] #---# Believe nothing - consider everything Russ Michell Anglia Polytechnic University Webteam e: [EMAIL PROTECTED] w: www.apu.ac.uk/webteam t: +44 (0)1223 363271 x 2331 www.theruss.com #---# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP-DB] Apache+PHP+MySQL installation at once - HOW?
Another option is http://www.firepages.com.au/devindex.htm Look for phpdev3: Apache, PHP, MySQL and phpMyAdmin in one zip, for windows platforms. all yours, Roel Mulder At 10:31 04-05-2001 -0500, you wrote: At 9:45 AM +0200 5/4/01, Vojtech Dvorak wrote: Hi, I want to install this great trio Apache+PHP+MySQL and don't want it install step by step, program by program. I remember, that I saw somewhere some prepared package for very fast and comfortable installation of these three at once. Don't you now where I can find it? Thanks Vojtech http://www.nusphere.com/ Paul DuBois, [EMAIL PROTECTED] Mulder Technisch Advies Postbus 69 NL-2740 AB WADDINXVEEN tel. 0182-640184 fax. 0182-640185 http://www.mta.nl -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-DB] Apache, PHP, MySQL
I'm having a spot of trouble getting the php-mysql-4.0.1pl2-9.i386.rpm package to install. Its a Redhat 7.0 installation with MySQL 3.23.36-1 installed. I'm currently using MySQL with ICRADIUS0.17b so I know that MySQL is installed and working yet I get: rpm -i php-mysql-4.0.1pl2-9.i386.rpm error: failed dependencies: mysql is needed by php-mysql-4.0.1pl2-9 libmysqlclient.so.9 is needed by php-mysql-4.0.1pl2-9 How can I get the information I need to install this package manually? I've looked all over the MySQL and PHP page with not even a mention of php-mysql (even a valid on-topic result from the search engines on both sites). the php-mysql rpm is the same version as php installed on the machine. I was playing around with a box with 7.1 and the package (php-mysql-4.0.4pl1-9.i386.rpm) installed just fine on that machine. Any ideas? Robert Staph, W3RCS The Center for Advanced Technologies