Welcome Guest, Not a member yet? Register   Sign In
DB Query issues
#1

[eluser]stevefink[/eluser]
Can anyone tell me why $photos in my view is not being seen by my view? I keep getting a notice that it is an undefined variable. I've made sure $photos is being populated properly in the model/controller:

Here's my controller:

Code:
function get_photos()
    {
        // get all photo filesystem locations.
        $photos = $this->autodb->get_photos();
        $this->load->view('console/vehicle_photos_view', $photos);
    }

My model:

Code:
function get_photos()
    {
        // return all available photos for vehicle
        $sql = "select photoloc from photos";
        $all_photos = $this->db->query($sql);
        
        $photos = array();
        
        if ($all_photos->num_rows() > 0)
        {
            foreach ($all_photos->result_array() as $photo)
            {
                $photos[] = $photo;
            }
        }
        
        return $photos;
    }

$photos is still undefined after $this->load->view('console/vehicle_photos_view', $photos);

Any idea?


Messages In This Thread
DB Query issues - by El Forum - 08-21-2007, 04:03 PM
DB Query issues - by El Forum - 08-21-2007, 04:13 PM
DB Query issues - by El Forum - 08-21-2007, 04:22 PM
DB Query issues - by El Forum - 08-21-2007, 04:27 PM
DB Query issues - by El Forum - 08-21-2007, 04:29 PM
DB Query issues - by El Forum - 08-21-2007, 04:30 PM
DB Query issues - by El Forum - 08-21-2007, 05:20 PM
DB Query issues - by El Forum - 08-21-2007, 05:55 PM



Theme © iAndrew 2016 - Forum software by © MyBB