[eluser]phused[/eluser]
I'm having an issue with my models, each time I load a model on one of my controllers the page appears blank. For example, this is one of my controllers:
Code:
<?php
class Tickets extends Controller {
function Tickets()
{
parent::Controller();
$this->load->model('Tickets_model');
}
function index()
{
$this->load->view('header');
$this->load->view('navigation');
$this->load->view('tickets_index');
$this->load->view('footer');
}
function view()
{
$this->load->view('header');
$this->load->view('navigation');
$this->load->view('tickets_view');
$this->load->view('footer');
}
}
?>
My tickets model has the following code, fairly simple and easy:
Code:
<?php
class Tickets_model extends Model {
function Tickets_model()
{
// Call the Model constructor
parent::Model();
}
// Connect to database
$this->load->database();
function display_open_tickets
{
$query = $this->db->query('SELECT id, title, priority FROM tickets');
foreach ($query->result_array() as $row)
{
echo $row['id'];
echo $row['title'];
echo $row['priority'];
}
}
}
?>
When I try to access /tickets page, it appears blank. However, once I remove the $this->load->model('Tickets_model'); it loads perfectly fine. I have tried to uncomment certain sections of the model to see if it was a specific part of it, but it all combinations lead to the Tickets index() page rendering blank.
Any ideas?