My statements are all working but I'm not sure if
things are set up correctly. I say this because at
one point the first $query failed, yet the rest of
inserts wre committed. Now I believe I need to set
autocommit to 0 , yet the query failed due to a syntax
error. Hence the rule about 0 records effected
wouldn't be the case here.
Here is what I have:
//Create these functions -
function begin()
{
mysql_query("BEGIN");
}
function commit()
{
mysql_query("COMMIT");
}
function rollback()
{
mysql_query("ROLLBACK");
}
connection statement with error checking...........
begin(); // transaction begins
$query = "INSERT INTO firsttable.....//first query
$result = mysql_query($query); // process first query
$query = "INSERT INTO secondtable...//second query
$result = mysql_query($query); // process second query
$query = "INSERT INTO thirdtable....//third query
$result = mysql_query($query); // process third query
then:
if(!$result)
{
echo mysql_errno($link) . ": " . mysql_error($link).
"\n";
rollback(); // transaction rolls back
exit;
}
else
{
commit(); // transaction is committed
echo "your insertion was successful";
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]