mysqli_insert_id() expects exactly 1 parameter, 0 given in CodeIgniter

Viewed 10405

I have a problem, Please Help me. I'm using Code igniter This is my code.

my Models (M_register.php)

class M_register extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }

    function add_account($data)
    {
        $this->load->database();
        $this->db->insert('login',$data);           
        **return  mysqli_insert_id();**
    }

    function changeActiveState($key)
    {
        $this->load->database();
        $data = array(
           'active' => 1
        );

        $this->db->where('md5(id)', $key);
        $this->db->update('login', $data);

        return true;
    }
}

And this is partly code in Controller $data = array(

        'username' => $username,
        'password' => $password,
        'nama' => $nama,
        'email' => $email,
        'active' => 0
    );
    $this->load->model('m_register');
    **$id = $this->m_register->add_account($data);**        
    $encrypted_id = md5($id);
enter code here

And this My error:

enter image description here

3 Answers
Related