Reputation: 1005
I need a little help. How can i send this query with codeigniter?
Delete FROM friendconnect WHERE who = 5 and whos = 1 OR whos = 5 and who = 1;
I found only that:
$this->db->where('id', $id);
$this->db->delete('mytable');
Thanks everybody!
Upvotes: 1
Views: 12633
Reputation: 3743
$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 is also an alternative:
$this->db->where('who', 5)->where('whos', 1)->or_where('whos', 5)->where('who', 1);
$this->db->delete('friendconnect');
This also:
$this->db->where(array('who'=>5, array('whos'=>1)))->or_where('whos', 5)->where('who', 1);
$this->db->delete('friendconnect');
More info: here
Upvotes: 6
Reputation: 786
$this->db->where('(who = 5 and whos = 1) OR (whos = 5 and who = 1)');
$this->db->delete('friendconnect');
Upvotes: -1
Reputation: 81
Just use this $this->db->query("Delete FROM friendconnect WHERE who = 5 and whos = 1 OR whos = 5 and who = 1");
Upvotes: -1