Welcome Guest, Not a member yet? Register   Sign In
Cutom string in where statement
#1

[eluser]zovar[/eluser]
CI user guide says that we can use custom strings in $this->db->where():

Code:
$where = "name='Joe' AND status='boss' OR status='active'";

$this->db->where($where);

My string is as follows
Code:
$where = " tag='test' OR tag='test1' ";

$this->db->select('id')->from('tags')->where($where);

i get the following error
Code:
A Database Error Occurred
Error Number: 1054

Unknown column 'tag='test'' in 'where clause'

UPDATE `notes` SET `title` = 'title' WHERE `tag='test'` OR tag='test1' AND `id` = '13'

as you can seen the first where statement gets escaped...


Messages In This Thread
Cutom string in where statement - by El Forum - 01-21-2009, 06:36 AM
Cutom string in where statement - by El Forum - 01-21-2009, 06:42 AM
Cutom string in where statement - by El Forum - 08-05-2009, 06:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB