CodeIgniter Forums

Full Version: One basic db where question
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[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');

El Forum

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