Welcome Guest, Not a member yet? Register   Sign In
Returns result from DB even though it's empty!
#1

[eluser]felixk[/eluser]
Controller:
Code:
function index()
    {
        $data['title'] = "Fabriken Fredag | Bildgalleri";
        $this->load->library('pagination');

        $config['base_url'] = site_url('/galleri/index/');
        $config['total_rows'] = $this->db->count_all_results('albums');
        $config['per_page'] = 4;
        $config['uri_segment'] = 3;
        $config['first_link'] = 'Första';
        $config['last_link'] = 'Sista';
        $this->pagination->initialize($config);
                
        //DB
                //Doesn't matter which one on of $data['albums'] i'm chosing.
        $data['albums'] = $this->db->get('albums');
        //$data['albums'] = $this->galleryModel->All($config['per_page'], $this->uri->segment(3));
        $this->load->view('galleri_view', $data);    
}

Viewer:
Code:
<?php if(empty($albums)): echo "Empty! :S"; ?>
      
        <?php else: ?>
        <h2>Bildgalleri!</h2>
            &lt;?php foreach($albums->result() as $row): ?&gt;
                &lt;?php echo $row->title; ?&gt;<br />
            &lt;?php endforeach; ?&gt;
        &lt;?php endif; ?&gt;


Messages In This Thread
Returns result from DB even though it's empty! - by El Forum - 08-31-2009, 09:26 AM
Returns result from DB even though it's empty! - by El Forum - 08-31-2009, 09:27 AM
Returns result from DB even though it's empty! - by El Forum - 08-31-2009, 09:36 AM
Returns result from DB even though it's empty! - by El Forum - 08-31-2009, 09:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB