Welcome Guest, Not a member yet? Register   Sign In
Help with a simple query
#6

[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');  
    }


Messages In This Thread
Help with a simple query - by El Forum - 03-12-2011, 11:09 PM
Help with a simple query - by El Forum - 03-13-2011, 12:02 AM
Help with a simple query - by El Forum - 03-13-2011, 12:07 AM
Help with a simple query - by El Forum - 03-13-2011, 02:31 AM
Help with a simple query - by El Forum - 03-13-2011, 04:36 AM
Help with a simple query - by El Forum - 03-13-2011, 01:49 PM
Help with a simple query - by El Forum - 03-13-2011, 02:20 PM
Help with a simple query - by El Forum - 03-13-2011, 03:12 PM
Help with a simple query - by El Forum - 03-13-2011, 03:41 PM



Theme © iAndrew 2016 - Forum software by © MyBB