Welcome Guest, Not a member yet? Register   Sign In
Problem With WHERE Clause
#1

[eluser]james182[/eluser]
I am trying to get this to work with showing data where the colour is equal to D,E,F,G.
Post data is:
certi all,
clarity all,
colour = D-E-F-G-,
cut = all,
flou = all,
maxprice = 100000,
maxval = 5,
minprice = 100,
minval = 0.01,
pg = 1,
polish = all,
scat_id = null,
shape = Princess,
sym = all

Code:
public function get_diamond_by_shape($shape,$scat_id,$colour,$clarity,$certification,$cut,$polish,$symmetry,$fluorescence,$min_carat,$max_carat,$min_price,$max_price)
{
  
  //$colours = "'". implode("','", explode('-', substr_replace($colour ,"",-1))) ."'";
  
  
  $colours = explode('-', substr_replace($colour ,"",-1));
  $clarities = explode('-', substr_replace($clarity ,"",-1));
  $certifications = explode('-', substr_replace($certification ,"",-1));  
  
  print_r($shape);
  
  $this->db->where('shape', $shape);
  $this->db->or_where_in('colour', $colours);
  $this->db->or_where_in('clarity', $clarities);
  $this->db->or_where_in('certification_type', $certifications);
  /*
  $this->db->where('cut', $cut);
  $this->db->where('polish', $polish);
  $this->db->where('symmetry', $symmetry);
  $this->db->where('fluorescence', $fluorescence);    
  */
  $this->db->where('carat >=', $min_carat);
  $this->db->where('carat <=', $max_carat) ;
  $this->db->where('cost BETWEEN ' . $min_price . ' AND ' . $max_price);
  
  $diamonds = $this->db->get('products_diamonds');
  
  //print_r($diamonds->result_array());
      
  return $diamonds->result_array();
  
}


Messages In This Thread
Problem With WHERE Clause - by El Forum - 06-22-2012, 01:47 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 01:53 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 02:10 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 02:39 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 03:22 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 03:43 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 04:10 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 04:21 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 06:55 AM
Problem With WHERE Clause - by El Forum - 06-22-2012, 06:50 PM
Problem With WHERE Clause - by El Forum - 06-22-2012, 10:34 PM
Problem With WHERE Clause - by El Forum - 06-22-2012, 10:38 PM
Problem With WHERE Clause - by El Forum - 06-22-2012, 10:50 PM
Problem With WHERE Clause - by El Forum - 06-22-2012, 10:56 PM
Problem With WHERE Clause - by El Forum - 06-22-2012, 11:13 PM
Problem With WHERE Clause - by El Forum - 06-22-2012, 11:16 PM
Problem With WHERE Clause - by El Forum - 06-23-2012, 02:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB