Welcome Guest, Not a member yet? Register   Sign In
Query not following rules!!
#1

[eluser]codemonkey[/eluser]
Hello,

Here is the query in question

Code:
$this->db->where('added_by', $tech);
$this->db->or_like($infoarray);
$this->db->limit(100);
$this->db->order_by('date_created', 'DESC');
$query = $this->db->get('item_history');
return $query->result();

Why doesn't the WHERE work? I want to limit the results based on the tech logged in.

Code:
$tech = $_SESSION['username'];
$match = $this->input->post('search');  
$infoarray = array(
'ticket_num' => $match,
'serial_num' => $match,
'part_num' => $match,
'make' => $match,
'model' => $match,
'user_first_name' => $match,
'user_last_name' => $match,
'reason' => $match,
'date_created' => $match
);

From profiler

Code:
SELECT *
FROM (`item_history`)
WHERE `added_by` =  'tech1'
AND  `ticket_num`  LIKE '%%'
OR  `serial_num`  LIKE '%%'
OR  `part_num`  LIKE '%%'
OR  `make`  LIKE '%%'
OR  `model`  LIKE '%%'
OR  `user_first_name`  LIKE '%%'
OR  `user_last_name`  LIKE '%%'
OR  `reason`  LIKE '%%'
OR  `date_created`  LIKE '%%'
ORDER BY `date_created` DESC
LIMIT 100

Thank you


Messages In This Thread
Query not following rules!! - by El Forum - 09-07-2012, 01:27 PM
Query not following rules!! - by El Forum - 09-07-2012, 01:30 PM
Query not following rules!! - by El Forum - 09-07-2012, 01:33 PM
Query not following rules!! - by El Forum - 09-07-2012, 01:45 PM
Query not following rules!! - by El Forum - 09-07-2012, 01:49 PM
Query not following rules!! - by El Forum - 09-07-2012, 02:04 PM
Query not following rules!! - by El Forum - 09-07-2012, 02:10 PM
Query not following rules!! - by El Forum - 09-07-2012, 02:23 PM
Query not following rules!! - by El Forum - 09-07-2012, 02:29 PM
Query not following rules!! - by El Forum - 09-07-2012, 05:00 PM
Query not following rules!! - by El Forum - 09-10-2012, 06:27 AM
Query not following rules!! - by El Forum - 09-10-2012, 07:17 AM
Query not following rules!! - by El Forum - 09-10-2012, 07:44 AM
Query not following rules!! - by El Forum - 09-10-2012, 08:07 AM
Query not following rules!! - by El Forum - 09-10-2012, 08:15 AM
Query not following rules!! - by El Forum - 09-10-2012, 08:38 AM
Query not following rules!! - by El Forum - 09-10-2012, 08:51 AM
Query not following rules!! - by El Forum - 09-10-2012, 09:14 AM
Query not following rules!! - by El Forum - 09-10-2012, 09:36 AM
Query not following rules!! - by El Forum - 09-10-2012, 11:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB