Db commit wordpress
try {
$wpdb->query('START TRANSACTION');
$result1 = $wpdb->delete( $table, $where, $where_format = null );
$resul2 = $wpdb->delete( $table, $where, $where_format = null );
if (! $result) {
throw new Exception('db error');
}
if ($result1 && $result2) {
$wpdb->query('COMMIT'); // if you come here then well done
} else {
$wpdb->query('ROLLBACK'); // // something went wrong, Rollback
}
} catch(Exception $e) {
$wpdb->query('ROLLBACK');
return $e->message();
}