I'm building a simple ToDo list in CodeIgniter as I just learn it.
I have a profile page which should show the user details + all the items he checked to do.
This is my view so far
<div class="profile_header">
<?php foreach ($users as $user) { ?>
<h4><?php echo $user['name']; ?></h4>
</div>
This is my controller
public function index(){
$this->load->model('model_users');
$query = $this->model_users->getUserInfo();
$data['users'] = null;
if($query){
$data['users'] = $query;
}
$this->load->view('profile/profile', $data);
}
And my model
public function getUserInfo(){
$user_email = $this->session->userdata('email');
$query = $this->db->get_where('users', array('email' => $user_email));
return $query->result_array();
}
Now you can see that I select the user information from the user table and send it to the view using the index controller function. Now if I want to get all the tasks
from list_task
table and show it on page, I assume I have to write a new model function and call it in my controller in a new function like getUserTasks
but how do I send them over to the view?