Welcome Guest, Not a member yet? Register   Sign In
[PROBLEM SOLVED] Is my condition correct? (keyword & country field)
#1

[eluser]solid9[/eluser]
Is these conditions correct?

Code:
function frontpage_records($per_page, $keyword, $country) {
if($country == 'all' OR $country == '' AND empty($keyword)) {
  $query = $this->db->select('swapid, date_posted, offering, seeking, photo, video, country')
    ->from('swap')
   ->limit($per_page, $this->uri->segment(3))
   ->order_by('swapid', 'DESC')
   ->get();
} else {
  $query = $this->db->select('swapid, date_posted, offering, seeking, photo, video, country')
    ->from('swap')
   ->where('country', $country)      
   ->like('offering', $keyword)
   ->limit($per_page, $this->uri->segment(3))
   ->order_by('swapid', 'DESC')
   ->get();
}

if ($query->num_rows() > 0)
{
  return $query->result_array();
} else {
  return FALSE;
}
}


Can you guys please check.
I'm a little confused because it doesn't do what it suppose to do.

Thanks in advanced.




Messages In This Thread
[PROBLEM SOLVED] Is my condition correct? (keyword & country field) - by El Forum - 06-30-2012, 09:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB