Check whether update_batch() is successful in CodeIgniter

前端 未结 2 1201
隐瞒了意图╮
隐瞒了意图╮ 2021-01-19 17:20

I\'m running update_batch() on a table in CodeIgniter and I\'d like to check whether it was successful.

I\'ve tried using affected_rows(), but that only counts the n

相关标签:
2条回答
  • 2021-01-19 17:40

    Use a simple instruction this will return true or false

    return $this->db->update_batch("sections", $data, "alias");
    
    0 讨论(0)
  • 2021-01-19 17:41
        $this->db->trans_start();
        $this->db->update_batch($table, $update, $variable);
        $this->db->trans_complete();        
        return ($this->db->trans_status() === FALSE)? FALSE:TRUE;
    

    Hope this helps!. Cheers!

    0 讨论(0)
提交回复
热议问题