Codeigniter 删除...在哪里...和

Codeigniter Delete ... Where ... and

我需要一点帮助。 我如何使用 codeigniter 发送此查询?

Delete FROM friendconnect WHERE who = 5 and whos = 1 OR whos = 5 and who = 1;

我只发现:

$this->db->where('id', $id);
$this->db->delete('mytable'); 

谢谢大家!

就用这个$this->db->query("Delete FROM friendconnect WHERE who = 5 and whos = 1 OR whos = 5 and who = 1");

$this->db->where('who', 5);
$this->db->where('whos', 1);
$this->db->or_where('whos', 5);
$this->db->where('who', 1);

$this->db->delete('friendconnect');

这也是一种选择:

$this->db->where('who', 5)->where('whos', 1)->or_where('whos', 5)->where('who', 1);
$this->db->delete('friendconnect');

这也是:

$this->db->where(array('who'=>5, array('whos'=>1)))->or_where('whos', 5)->where('who', 1);
$this->db->delete('friendconnect');

更多信息:here

$this->db->where('(who = 5 and whos = 1) OR (whos = 5 and who = 1)');
$this->db->delete('friendconnect');