How to write a CodeIgniter query builder script with AND and OR logic in the WHERE clause
I am using CodeIgniter and I want to get the records from the database using an OR operator in the WHERE clause.
I'm wanting records from the database where code is equal to 12 or 21 and status is 1.
public static function front_page_ads()
{
$CI = & get_instance();
$array = array('status' => 1, 'code' => '12' OR 'code' => '21');
$CI->db->where($array);
$CI->db->order_by('id', 'DESC');
$CI->db->limit(3);
$q = $CI->db->get('international');
$r = $q->result();
return $r;
}