Hey im using codeigniter and i got this error
A PHP Error was encountered
Severity: Notice
Message: Undefined variable: query
Filename: views/nyheder_view.php
Line Number: 2 A PHP Error was encountered
Severity: Warning
Message: Invalid argument supplied for foreach()
Filename: views/nyheder_view.php
Line Number: 2
my controller :
<?php
class Nyheder extends Controller {
function index()
{
$data['content'] = 'nyheder_view';
$this->load->view('includes/template', $data);
}
function vis()
{
//parent::controller();
$this->load->model('nyheder_model');
$data['query'] = $this->nyheder_model->load_nyheder();
$this->load->view('nyheder_view', $data);
}
}
?>
my view
<?php foreach($query as $row) : ?>
<h1><?php echo $row->overskrift; ?></h1>
<p><?php echo $row->indhold; ?></p>
<?php endforeach;?>