Very Simple Issue I cant solve

#1
[eluser]GamingFusion[/eluser]
I want the home page to displays the welcome message set in the info table of the database. Buts its not. why?

Model
Code:
function getInfo()
    {
        $query = $this->db->get('info');
        
        return $query->row();
    }

Controller (its doing other stuff just look at the last data entry(query))
Code:
function index()
    {            
    
    $is_logged_in = $this->session->userdata('isLoggedIn');
        
        if (!isset($is_logged_in) || $is_logged_in != TRUE)
        {
            $data['title'] = 'Theater 311';
            $data['heading'] = 'Welcome to Theater 311';
            $data['content'] = 'index';
            $data['css'] = 'site';
            $data['query'] = $this->database->getInfo();
        
            $this->load->view('includes/templates', $data);
        }
        else
        {
            $data['title'] = 'Theater 311';
            $data['heading'] = 'Welcome to Theater 311';
            $data['content'] = 'index';
            $data['css'] = 'site';
            $data['isLoggedIn'] = $this->session->userdata('isLoggedIn');
            $data['query'] = $this->database->getInfo();
        
            $this->load->view('includes/templates', $data);
        
        }
    }

View
Code:
<h1>&lt;?=$heading?&gt;</h1>
<p&lt;?=$this->typography->nl2br_except_pre($query->welcome)?&gt;</p>

#2
[eluser]The Casual Bot[/eluser]
Hey there,

you need to load your model

Code:
$this->load->model('getInfo');

then change

Code:
$data['query'] = $this->database->getInfo();

to

Code:
$data['query'] = $this->modelname->getInfo();

hope it helps

try here to

http://ellislab.com/codeigniter/user-gui...odels.html

#3
[eluser]Maurice Calhoun[/eluser]
Sorry, but I had to do this.

Code:
function index()
    {            
    
            $data['title'] = 'Theater 311';
            $data['heading'] = 'Welcome to Theater 311';
            $data['content'] = 'index';
            $data['css'] = 'site';
            $data['isLoggedIn'] = $this->session->userdata('isLoggedIn');
            $data['query'] = $this->modelname->getInfo();
        
            $this->load->view('includes/templates', $data);
        
    }


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.