[eluser]Miguel Diaz[/eluser]
I was put it in a single view that query and it is sending me this error.
A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: views/pruebadate-view.php
Line Number: 10
This is the foreach I have in my view
Code:
<?php foreach($todaysReservations as $rowtodaysReservations) :?>
<?=$rowtodaysReservations->reservationID;?>
<?php endforeach; ?>
this is my controller
Code:
<?php
class Prueba extends Controller {
function index()
{
//Optimizacion y conexion de tags para SEO//
$tags = $this->uri->uri_string();
$op['tags'] = $this->data_model->cargarTags($tags);
//Muestra Reservaciones por dia
$op['todaysReservations'] = $this->data_model->getTodaysreservations();
//Carga los extras al Template Layout//
$this->layouts->add_include('assets/js/.js');
//Vista//
$this->layouts->view('pruebadate-view', $op);
}
}
and this is the function model
Code:
function getTodaysreservations(){
$date = date('Y-m-d');
$op = array('reservationServicedate >' => $date);
$this->db->where($op);
$query = $this->db->get('reservations');
}