CodeIgniter Forums
One basic db where question - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: One basic db where question (/showthread.php?tid=26418)



One basic db where question - El Forum - 01-13-2010

[eluser]luffy[/eluser]
How to use active record to implement the function:

DELETE FROM `dt_crazy` WHERE `id` = '53' AND (`from_id` = '2' OR `to_id` = '2')


$this->db->where('id', $id);
$this->db->where('from_id', 2);
$this->db->or_where('to_id', 2);
$this->db->delete('dt_crazy');


One basic db where question - El Forum - 01-13-2010

[eluser]JHackamack[/eluser]
$this->db->where('id',$id);
$this->db->where('(from_id = "2" or to_id = "2")');
$this->db->delete('dt_crazy');