Welcome Guest, Not a member yet? Register   Sign In
CI 1.7.2 $this->db->like() issue?
#1

[eluser]Mr. Fulop[/eluser]
Hi everyone.
I have an issue when using like from active record.
Code:
$domeniu = 'whatever';

$this->db->set('field','1');
$this->db->like('other_field', $domeniu);
$this->db->limit(1);
$this->db->update('table');
The above produces:
Code:
UPDATE `table` SET `field` = '1' LIMIT 1;

While the following query works fine and it is what I want:
Code:
$this->db->query("update table set field='1' where other_field like '%$domeniu%' limit 1");

Am I missing something?

Cheers,
Alex
#2

[eluser]saidai jagan[/eluser]
I think u can do by,
Code:
$domeniu = 'LIKE %whatever%';

$this->db->set('field','1');
//$this->db->like('other_field', $domeniu);
$this->db->where('other_field', $domeniu);
$this->db->limit(1);
$this->db->update('table');
i think u never use this Wink
#3

[eluser]Mr. Fulop[/eluser]
Smile I am using the full mysql query (as I stated in my post) but the idea is to use the active record without full queries if you really want a database independent application.
The like function as described in the user guide should work fine, but in this case I think it doesn't or I missed something.




Theme © iAndrew 2016 - Forum software by © MyBB