[eluser]gscharlemann[/eluser]
Fatal error: Call to a member function result() on a non-object
This what I've got. The date information stored in the DB is of date field so my query looks like:
Code:
function get_years()
{
$this->db->distinct();
$this->db->select('YEAR(RACE_DATE) as \'year\'');
return $this->db->get('RACES');
}
the above is in the model file. The result is returned and then I try what you recommended:
Code:
$query = $this->my_model->get_years();
print_r($query);
foreach($query->result() as $row) {
print_r($row);
$years[$row->year] = $row->year;
}
$data['years'] = $years;
// call view...etc.
when I print_r on $query, I get the 2D array I had before, which I thought was an object that I could call ->result() on?