I need to be able to convert the following to Ci’s active record delete method but I don’t know how to use the OR in the delete statement. Could you please tell me how I’d do this correctly?
$this->db->query("DELETE FROM friend WHERE userid_friends = '{$userid}' AND friendId_friends = '{$targetedUserId}' OR userid_friends = '{$targetedUserId}' AND friendId_friends = '{$userid}' ");
I guess your trying this:
(note the added parentheses for the two AND clauses)
But actually your not using CI’s “DELETE” method just a query.
Using active record delete would be something like:
For debugging of complex queries I recommend you to use
As it shows you exactly how the final query was rendered by the Active record methods.