What say NOW :
function autocommitfalse(){
global $db;
/* switch autocommit status to FALSE. Actually, it starts transaction */
return mysqli_autocommit($db, FALSE);
}
function autocommittrue(){
global $db;
return mysqli_autocommit($db, TRUE);
}
function commitquery(){
global $db;
return mysqli_commit($db);
}
function rollbackedquery(){
global $db;
return mysqli_rollback($db);
}
======
try {
autocommitfalse();
$SQLSELECT = "SELECT * FROM BC ";
$result_as = db_query($SQLSELECT);
if(!$result_as ){
throw new Exception('Wrong SQL SELECT: ' . $SQLSELECT_a. ' Error: '.db_error_msg($db) . db_error_no());
}
$sqla ="INSERT INTO A () VALUES () ";
$result_a = db_query($sqla);
if(!$result_a){
throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());
}
$sqlb ="INSERT INTO B () VALUES () ";
$result_b =db_query($sqlb);
if(!$result_b){
throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());
}
$sqlCb ="UPDATE CB () SET ... ";
$result_Cb =db_query($sqlCb);
if($result_Cb === false && mysqli_affected_rows($db) == 0 ){
throw new Exception('Wrong SQL SELECT: ' . $result_a. ' Error: '.db_error_msg($db) . db_error_no());
}
commitquery();
echo 'Transaction completed successfully!';
} catch (Exception $e) {
echo"<br \>";
echo "<table align=center><tr><td>";
echo $e->getMessage();
echo "</td></tr></table>";
echo"<br \>";
echo display_error(_("Transaction failed: transaction rolled back"));
rollbackedquery();
}
autocommittrue();
If something wrong ..please let me know with change in it ( above code ) ..so that i am more clear ....
Ohh i think still not rollback... hmm admin please help me guys please