我需要一些帮助。如何使用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->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');
更多信息:此处
只需使用此$this->db->query("Delete FROM friendconnect WHERE who = 5 and whos = 1 OR whos = 5 and who = 1");
$this->db->where('(who = 5 and whos = 1) OR (whos = 5 and who = 1)');
$this->db->delete('friendconnect');