Welcome Guest, Not a member yet? Register   Sign In
Model does weird(solved)
#1

[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):?>
                
[&lt;?=date('H:i', $row->datum);?&gt;] &lt;?=anchor('main/nieuws_bekijk/'.$row->nieuwsid, $row->onderwerp);?&gt;<br />
                
&lt;?php endforeach; ?&gt;

Fatal Error: Call to a member function_result() on a non-object in ... on line 31

Line 31 in that file:
Code:
&lt;?php foreach($query->result() as $row):?&gt;


Messages In This Thread
Model does weird(solved) - by El Forum - 06-25-2008, 01:28 AM
Model does weird(solved) - by El Forum - 06-25-2008, 01:36 AM
Model does weird(solved) - by El Forum - 06-25-2008, 01:40 AM
Model does weird(solved) - by El Forum - 06-25-2008, 01:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB