[eluser]Hakkam[/eluser]
How about if you print out the $this->db->last_query() ??
[quote author="techneke" date="1248121017"]Here what I need to do. Select some information for a location of a store, where certain options are true.
For example, all locations within 5 miles of 61108 where UPS shipping is offered. I have a geocoded Zip Code Library, so i've got an array of locations close to the zipcode I need.
And here in the code in my model:
Code:
function advanced_search($zip_codes, $options) {
$data = array();
$this->db->select('*')->from('db_stores');
$this->db->like('store_zip', $this->input->post('zip_code'), 'after');
if (count($options)) {
foreach ($options as $key => $option) {
$this->db->where($key, '1');
}
}
if ($zip_codes != NULL) {
foreach ($zip_codes as $zip_code => $mileage) {
$this->db->where('store_zip', $zip_code);
}
}
$Q = $this->db->get();
if ($Q->num_rows > 0) {
foreach($Q->result_array() as $row) {
$data[] = $row;
}
}
$Q->free_result();
return $data;
}
The loops are running as expected, by results are not as expected. any SQL ninja can help?[/quote]