[eluser]buckboru[/eluser]
I am going through a simple todo list tutorial and receiving the following.
I received this on another tutorial and just gave up because i couldn't find a resolution.
Can someone tell me what the cause of this is and how to avoid it?
Thanks
Here are my files.
Controller:
Code:
<?php
class Todo extends Controller {
public function __construct()
{
parent::__construct();
$this->load->model('Todo_model');
$this->load->database();
}
function index()
{
$data['todo_list'] = $this->Todo_model->getNextTodo();
$data['completed_list'] = $this->Todo_model->getCompletedTodo();
$this->load->view('todo/index', $data);
}
}
?>
MODEL:
Code:
<?php
class Todo_model extends Model {
public function __construct()
{
// model constructor
parent::__construct();
}
function getCompletedTodo()
{
$query = $this->db->get_where('tstmis.todo', array('STATUS' => 0));
return $query->result();
}
function getNextTodo()
{
$query = $this->db->get_where('tstmis.todo', array('STATUS' => 1));
return $query->result();
}
}
?>
VIEW
Code:
<html>
<head>
<title>CodeIgniter To Do List Application</title>
</head>
<body>
<h1>Welcome to CodeIgniter To Do List Application!</h1>
<h2>Next</h2>
<?php if($todo_list): ?>
<ul>
<?php foreach($todo_list as $todo): ?>
<li><h3><?= $todo->name ?></h3>
<?php if($todo->description): ?><p><?= $todo->description ?></p><?php endif ?>
</li>
<?php endforeach ?>
</ul>
<?php else: ?>
None
<?php endif ?>
<h2>Completed</h2>
<?php if($completed_list): ?>
<ul>
<?php foreach($completed_list as $todo): ?>
<li><h3><?= $todo->name ?></h3>
<?php endforeach ?>
</ul>
<?php else: ?>
None
<?php endif ?>
</body>
</html>