Welcome Guest, Not a member yet? Register   Sign In
require all values in array to be matched when using where_in
#5

[eluser]Andy UK[/eluser]
Here is the query for what it's worth...

Code:
$this->db->select("property.id,
       property.city_id,
       property.barrio_id,
       property.property_type_id,
       property.transaction_type,
       property.currency_id,
       property.{$price} as price,
       property.sale_price,
       property.rental_price,
       property.beds,
       property.baths,
       property.area,
       barrios.barrio")
    ->select('group_concat(feat_prop_join_concat.feature_id) as feature_id_concat', FALSE)
    ->join('feat_prop_join', 'property.id = feat_prop_join.property_id', 'left')
    ->join('feat_prop_join as feat_prop_join_concat', 'property.id = feat_prop_join_concat.property_id', 'left');
  
  // Features Filter
  if(is_array($this->session->userdata('selected_features')) && count($this->session->userdata('selected_features')) > 0)
  {
   $this->db->where_in('feat_prop_join.feature_id', $this->session->userdata('selected_features'));
  }

  $this->db->where('published', '1');
  $this->db->group_by('property.id');
  $this->db->distinct();
  $this->db->from('property');
  $result_array['all'] = $this->db->get();
  $result_array['num_rows'] = $result_array['all']->num_rows();

  return $result_array;


Messages In This Thread
require all values in array to be matched when using where_in - by El Forum - 08-27-2014, 07:57 PM



Theme © iAndrew 2016 - Forum software by © MyBB