[eluser]lennierb5[/eluser]
So I have a filter / search function that checks if post data exists and then adds a $this->db->where clause and then eventually executes the query at the end.
I also want to set session data but what happens is when I set session data AFTER a $this->db->where it tries to include that in the session update to the database.
Example:
Code:
if ($this->input->post('accountnumfilterentry')) {
$this->db->where('job_data.account_num', $this->input->post('accountnumfilterentry'));
$this->session->set_userdata('accountnumfilterentry', $this->input->post('accountnumfilterentry'));
}
Will produce the error:
Code:
A Database Error Occurred
Error Number: 1109
Unknown table 'job_data' in where clause
UPDATE `ci_sessions` SET `last_activity` = '1246042513'
...
WHERE `job_data`.`account_num` = 'ACCOUNTNUMBER' AND `session_id` = '64409e296c1088b68bb7ca555d7ecb4f'
If you put it before the where clause it processes fine but then gets hung up in the next set of IF statements if is more than one filtered item.