[eluser]Met[/eluser]
Code:
$data['query2']=$this->db->query('SELECT * FROM `reservering` WHERE `ResDatum`='.$query1->result().'');
this line is definitely wrong - the WHERE condition is a result set
this is untested, but do all the foreaching before you pass the data
so, for every result from the first query, you want to do another query using $row['ResDatum'] as a WHERE condition. and store results of THIS query in to an array.
then pass that to the view.
I see what you're trying to do but I don't think it will ever work that way - there is a huge difference between while() and foreach()
in my head its something like
Code:
$query1=$this->db->query('SELECT Resdatum FROM `reservering` GROUP BY `ResDatum`');
foreach($query1->result() as $row)
{
//without testing not sure, you need to pass the result array in to another array
$query2[]=$this->db->query('SELECT * FROM `reservering` WHERE `ResDatum`='.$row->ResDatum.'');
}
//pass $query1 and $query2 to a $data array, load the view with this.
there might be a problems with performance though with this.
edit - on a second thought, could you not just use a JOIN?