php - MySQL will not insert transaction -
i trying transaction execute. can normal query execute not transaction.
these queries:
$queries[] = "start transaction"; $queries[] = "insert `customer_register` ( `c_email`,`web_customer_id`,`c_realname`,`c_password` ) values ( 'support@mail.com','1','name','test' )"; $queries[] = "commit";
method commit transaction:
private function commit_transaction($queries) { foreach($queries $query) { if($this -> db -> blank_query($query)) { continue; } else { $this -> db -> blank_query("rollback"); return false; } } return true; }
method execute query:
public function blank_query($query) { $result = mysqli_query($this -> link, $query); if(mysqli_errno($this -> link)) { if(!empty($this -> note)) { $this -> note -> pushnotification('error', "error executing blank query"); } $this -> write_to_log('error: ' . mysqli_error($this -> link) . ' query: ' . $query); return false; } else { return $result; } }
if do:
$this -> db -> blank_query("insert `customer_register` ( `c_email`,`web_customer_id`,`c_realname`,`c_password` ) values ( 'support@mail.com','1','name','test' )");
everything goes great, sumitting 10, 20 or 100 queries on page load need to fast. transaction commits fine in phpmyadmin:
"start transaction; insert `customer_register` ( `c_email`,`web_customer_id`,`c_realname`,`c_password` ) values ( 'support@mail.com','1','name','test' ); commit;"
Comments
Post a Comment