[eluser]scm22ri[/eluser]
Hi,
Thanks for your reply but I'm a little confused. If I don't pass the user_id in the form then how would the correct information in the database be updated? If I'm user "24", I only want user ID's 24 information to be updated.
Also, when you say "session value" do you mean the session ID?
Code:
$sessionid = $this->session->userdata('session_id');
(When I echo out the $sessionid every few minutes I get a new very long number. Is this number unique to the user? Can this information be passed into my user_id field? Please advise.)
What am I doing wrong? Thanks
My new function would look something like this
Code:
public function update_records(){
$now = date("Y-m-d H:i:s");
$form_data = array(
'business' => $this->input->post('business'),
// 'user_id' => $this->input->post('user_id'),
'address' => $this->input->post('address'),
'state' => $this->input->post('state'),
'city' => $this->input->post('city'),
'zip' => $this->input->post('zip'),
'phone' => $this->input->post('phone'),
'website' => $this->input->post('website'),
'email' => $this->input->post('email'),
'name' => $this->input->post('name'),
'time' => $now
);
$this->load->model('Change_data');
$this->Change_data->update_function_three($form_data);
My new model
Code:
function update_function_three($formdata){
// This isn't working
$this->db->where('user_id',$sessionid );
$this->db->update('business',$formdata);
}