or_like() Query in Codeigniter

This tutorial shows you how to write or like query in codeigniter. This method is identical to the one above, except that multiple instances are joined by OR.

Let’s create a or_like method in codeigniter

$this->db->like('title', 'match'); 
$this->db->or_like('body', $match);
// WHERE `title` LIKE '%match%' ESCAPE '!' OR  `body` LIKE '%match%' ESCAPE '!'

Note: or_like() was formerly known as orlike(), which has been removed.

Leave a Reply

Your email address will not be published. Required fields are marked *