Welcome Guest, Not a member yet? Register   Sign In
Curved (round) brackets and active records
#1

[eluser]Unknown[/eluser]
Hi guys, I'm having trouble with curved brackets in my active records query.

Code:
$this->db->where("manufacturer_id = ".$data['values']['id']);
$this->db->like("name", $data['values']['name']);
$result = $this->db->get('dealers');

The above code returns no results while the code below does.

Code:
$this->db->where("manufacturer_id = ".$data['values']['id']);
$this->db->like("name", "arnold clark (aberdeen)");
$result = $this->db->get('dealers');

The only difference I can see is that the first statement has the name value in an array and the second has it hard coded. I checked the out put of each query and they look identical.

Code:
SELECT * FROM (`dealers`) WHERE manufacturer_id = 3 AND name LIKE %arnold clark (aberdeen)%

SELECT * FROM (`dealers`) WHERE manufacturer_id = 3 AND name LIKE %arnold clark (aberdeen)%

Any help on this would be gratefully received.

Thanks




Theme © iAndrew 2016 - Forum software by © MyBB