Welcome Guest, Not a member yet? Register   Sign In
Having trouble with Codeigniter library
#1

(This post was last modified: 11-14-2022, 05:28 AM by WilnarMasonik.)

I am working with a codeigniter library called MY_Model.php in that developerbook chatrandom model there is the following function,

public function omegle update($primary_value, $data, $skip_validation = FALSE)
{
    $valid = TRUE;
    if($skip_validation === FALSE)
    {
        $valid = $this->_run_validation($data);
    }

    if($valid)
    {
        $this->skip_validation = FALSE;
        return $this->db->where($this->primary_key, $primary_value)
            ->set($data)
            ->update($this->_table);
    }
    else
    {
        return FALSE;
    }
}
I then executing the function with the following code,

$update = array('last_logged_in', date("Y-m-d H:iConfused"));
            if($this->ci->users_model->update($query[0]['user_id'], array('last_logged_in', date("Y-m-d H:iConfused"))))
            {
                $this->session->set_flashdata('success', 'You have successfully been logged in');
                switch($query['user_type_id'])
                {
                    case 1:
                        redirect('/candidate/dashboard');
                        break;

                    case 2:
                        redirect('/employer/dashboard');
                        break;

                    case 3:
                        redirect('/admin/dashboard');
                        break;
                }
            }
However I am getting the following errors,

A Database Error Occurred

Error Number: 1054

Unknown column '0' in 'field list'

UPDATE users SET 0 = 'last_logged_in', 1 = '2011-04-28 21:06:51' WHERE user_id = '2'
Reply




Theme © iAndrew 2016 - Forum software by © MyBB