[eluser]Jesse2303[/eluser]
PROBLEM SOLVED
Hi all
I've forgooten to make my models and now when I'm trying to make them I get stuck every time.
I want to show the last 3 titels of the news, links, pictures.
Can you look @ my script please ?
Class: Main, Function dashboard()
Code:
function dashboard() {
$this->load->model('show');
$data['query'] = $this->show->get_nieuws();
$data['link'] = $this->show->get_links();
$data['pics'] = $this->show->get_pics();
$this->load->view('dashboard_view', $data);
}
Class Show, Function get_nieuws, get_links, get_pics
Code:
class Show extends Model {
function Show() {
parent::Model();
}
function get_nieuws() {
$get_nieuws = $this->db->query('SELECT * FROM nieuws ORDER BY datum DESC LIMIT 3');
}
function get_links() {
$get_links = $this->db->query('SELECT * FROM links ORDER BY id DESC LIMIT 3');
}
function get_pics() {
$get_pics = $this->db->query('SELECT * FROM pics ORDER BY datum DESC LIMIT 3');
}
}
My output script
Code:
<?php foreach($query->result() as $row):?>
[<?=date('H:i', $row->datum);?>] <?=anchor('main/nieuws_bekijk/'.$row->nieuwsid, $row->onderwerp);?><br />
<?php endforeach; ?>
Fatal Error: Call to a member function_result() on a non-object in ... on line 31
Line 31 in that file:
Code:
<?php foreach($query->result() as $row):?>