[eluser]tim1965[/eluser]
This is really confusing me and i would appreciate some help.
I have a function that runs a search against two dates and an amount field.
Function below
function check_charges()
{
$price_per_week =($this->input->post('price_per_week', TRUE) == FALSE) ? '9999' : $this->input->post('price_per_week');
$start_date = ($this->input->post('start_date', TRUE) == FALSE) ? date('Y-m-d') : $this->input->post('start_date');
$end_date = ($this->input->post('end_date', TRUE) == FALSE) ? date('Y-m-d') : $this->input->post('end_date');
$t ="SELECT property_id
FROM v_charges_date_price
WHERE $start_date between `start_date1` and `end_date1`
OR $end_date between `start_date1` and `end_date1`
AND $price_per_week <= 'price_per_week_1'
";
$query_results = $this->db->query($t);
if($query_results->num_rows() >0)
{
$row=$query_results->result_array();
//var_dump($row);
foreach ($row as $val){
$v=$val['property_id'];
$charges=$v;
//var_dump($charges);
return $charges;
}
}
If i var_dump$charges with the return commented out i get this which is correct (7 and 8)
Quote:
string(1) "7" string(1) "8"
Quote:
However if i then add the return the array only contains 7 and not 8 i.e. its dropping everything after the first result
Quote:
string(1) "7"
Quote:
My controller is
Quote:
$charges = $this->M_search_v1->check_charges();
Quote:
Either i am missing something blindingly obvious or there is something funny going on here. All help appreciated.