Welcome Guest, Not a member yet? Register   Sign In
qb_where has 2 arrays of conditions value escape

(02-22-2020, 10:58 AM)jreklund Wrote: Hi, can you post the actual code resulting in this result.
Thanks for the reply.  The code is in 2 controllers and a large model.  The model includes code that I think should be in the controllers.  One of the controllers handled most of the page building, the other controller was a search.  The search controller called into the same model as the page.   
basically it was setup to pass in an area of values

in the model, it tried to differentiate between what was wanted by checking the array 'where" that was passed it.

$this->db->where("{$this->categories_table}.id", $where['category_id']);

$this->db->where_not_in("{$this->_table}.id", $where['hidden_post_id']);

$this->db->like("{$this->_table}.title", $where['keyword'],'both');
 $this->db->like("{$this->_table}.body", $where['keyword'],'both');
unset($where['keyword']); // crash when deleted


foreach ($where as $key => $value) {
$this->db->where($key, $value);

The search controller did this
//$base_where = array_merge($base_where,array('keyword'=>$this->input->post('keyword')));

but, base_where was already set from a prior action - 

So i got rid of the array_merge and my problems went away
I wrote my first program in 15 minutes. It took me 3 hours to keypunch it.

I wrote my first BASH script in 5 minutes. It took me a day to find out I had to put a . (period) in front of it to get it to execute.

Messages In This Thread
RE: qb_where has 2 arrays of conditions value escape - by gmgj - 02-22-2020, 03:21 PM

Theme © iAndrew 2016 - Forum software by © MyBB