Why is my password not being inserted into the DB
Model:
function addUser($userData = NULL, $passwordHash)
{
$this->db->insert('users',$userData,$passwordHash);
return TRUE;
}
Controller:
public function addUser()
{
$data['pageTitle'] = 'GA Add User';
$this->load->view('_assets/header', $data);
$this->load->view('addUser', $data);
$this->load->view('_assets/footer');
$userData = array(
'fName' => $this->input->post('userFirstName', TRUE),
'lName' => $this->input->post('userLastName', TRUE),
'email' => $this->input->post('userEmail', TRUE)
);
$passwordHash = sha1($this->input->post('userPassword', TRUE));
$this->db->escape($userData);
$this->user_model->addUser($userData, $passwordHash);
}
EDIT:
Added the password to the $userdata array to keep it cleaner. And modified the addUser function. You don’t need to escape the data, the DB library will do it for you. NOTICE that you have to load views at the end of the script