Not sure you did it. Usually you call your model from the controller. In your case, it will be:
class Site extends CI_Controller{ public function index(){ // load your model $this->load->model('adminmodel'); // do your fancy stuff $data['allQA'] = $this->adminmodel->getAllQA(); // here you can pass additional data eg $data['userdata'] = $this->adminmodel>getuserinfo(); // pass data from controller --> view $this->load->view('home',$data); } }
You can access the data in the view file by specifying $ allQA or $ userdata respectively. For instance.
foreach ($allQA as $qa){ echo $qa->question . "<br>" . $qa->option . "<br>"; }
or somewhere in the div
<div class="userbadge"> <?php echo $userdata; ?> </div>
source share