I'm doing an insert with Codeigniter 3 , in MySQL , which works fine, the idea is now to implement the rollback , but for some reason it doesn't.
This is my code:
$this->db->trans_strict(false);
$this->db->trans_start();
$this->usuario = $json['usuario'];
$this->clave = md5($json['claves']);
$this->perfil_id = $json['perfil_id'];
$this->estado = $json['estado'];
$this->db->insert('usuario', $this);
$this->db->trans_complete();
if ($this->db->trans_status() === FALSE) {
$this->db->trans_rollback();
return false;
} else {
$this->db->trans_commit();
return true;
}
I appreciate any suggestion.