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

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

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.


<?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

// 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

Reply via email to