0

I'm trying to figure out why I'm getting the error You must use the "set" method to update an entry. when I use the following method. I am using Jamie Rumbelow's MY_Model to do this.

$this->failed_login->insert_login_attempt($this->input->ip_address(), 
                                $post_username,
                                gmdate('Y-m-d H:i:s', time())); 

public function insert_login_attempt($user_ip_address, $username, 
                                $datetime_of_attempt)
{

    $failed_attempt = array(
        'user_ip_address' => $user_ip_address,
        'username' => $username,
        'datetime');
    $this->db->insert($failed_attempt);

}
4

1 回答 1

3

$this->db->insert需要知道要将表插入到哪个表中。如果你不给它一个表格,它怎么知道把数据放在哪里?:-P

$failed_attempt = array(
    'user_ip_address' => $user_ip_address,
    'username' => $username,
    'datetime' => $datetime_of_attempt);

$this->db->insert('YOUR_TABLE', $failed_attempt);

编辑:由于您使用的是jamierumbelow'sMY_Model,因此您需要遵循他们的文档。

$failed_attempt = array(
    'user_ip_address' => $user_ip_address,
    'username' => $username,
    'datetime' => $datetime_of_attempt);

$this->insert($failed_attempt);
// OR $this->failed_login->insert($failed_attempt);
于 2013-07-31T16:43:56.747 回答