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

[eluser]solid9[/eluser]
I'm trying to echo the country variable but it's empty.
Code:
function frontpage_records($per_page, $keyword='', $country='all') {
  echo 'country: ';
  echo $country;
  if($country == 'all' 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;
  }
}


why?



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



Theme © iAndrew 2016 - Forum software by © MyBB