Codeigniter Transactions

前端 未结 6 1751
离开以前
离开以前 2020-11-28 07:21

I\'m using Codeigniter transactions

$this->db->trans_start();
$this->db->query(\'AN SQL QUERY...\');
$this->db->trans_complete();
         


        
6条回答
  •  长情又很酷
    2020-11-28 08:15

    For single insert or update record you can use affected_rows function

    $this->db->insert('table_name', xss_clean($data));
    
    
    //Check if there is a record affected
    if($this->db->affected_rows() > 0)
                  {
                      return true;
                  }
                  else
                  { 
                      // if not succeeded
                      // check your last query 
                      die($this->db->last_query());
                  }
    

提交回复
热议问题