[eluser]Unknown[/eluser]
Hello. I am trying to create a simple to do list app. I want a site to list the various clients I have and the To Dos assigned to each.
I am having trouble pulling the lists for every client. My setup currently only pulls the last client's data.
Controller
Code:
function index() {
$this->load->model('client');
$this->load->model('task');
$data['client'] = $this->client->get_clients();
foreach ($data['client'] as $client) {
$id_client = $client['id_client'];
$data['task'] = $this->task->get_tasks($id_client);
}
$this->load->view('cloud_view', $data);
}
In the models, I return results as "result_array();"
Also, after pulling the data, how do I display it in the view?
View
Code:
<?php foreach ($client as $c) : ?>
<?php echo $c['name_client']; ?>
<?php echo $c['id_client']; ?>
<ul>
<?php foreach ($task as $t) : ?>
<?php if ($c['id_client'] == $t['id_client']) { ?>
<li><?php echo $t['content_task']; ?></li>
<?php } ?>
<?php endforeach; ?>
</ul>
<?php endforeach; ?>
Any help is greatly appreciated. Thanks.