Simple question but I don't know why it is not printing correctly or working as expected. I have this in model (works because when I print_r($result) it shows data:
function get_latest_entries()
{
$query = $this->db->get('property');
return $query->result_array();
}
And for controller:
public function index()
{
$resultSet['properties'] = $this->propertymodel->get_latest_entries();
$this->load->view('home', $resultSet);
}
In the view I want to iterate over the array (the table has description, city, address columns):
<?php
foreach($resultSet as $item)
{
echo $item->city;
echo $item->description;
}
?>
I am getting two records on home page where am displaying the results as above:
Severity: Notice Message: Undefined variable: resultSet Filename: views/home.php Line Number: 16
And
Severity: Warning Message: Invalid argument supplied for foreach() Filename: views/home.php Line Number: 16