CodeIgniter Forums
Problem enabling error messages - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: Problem enabling error messages (/thread-47675.html)



Problem enabling error messages - El Forum - 12-17-2011

[eluser]Unknown[/eluser]
Hi,

I've just started with codeigniter and I am currently expermenting with database operations.

However, my problem is that my error messages dosen't seem to be enabled.

This is my codeigniter/index.php file:

Code:
if (defined('ENVIRONMENT'))
{
switch (ENVIRONMENT)
{
  case 'development':
   error_reporting(E_ALL);
  break;

  case 'testing':
  case 'production':
   error_reporting(E_ALL);
  break;

  default:
   exit('The application environment is not set correctly.');
}

Here is my view, controller and model that I am working with:

home.php (view)

Code:
<?php
foreach($rows as $r)
{
  echo "<h1>" . $r->title . "</h1>";
}
?&gt;

site.php (controller)

Code:
&lt;?php
class Site extends CI_Controller {

public function index()
{
  $this->load->model("data_model");
  $data['rows'] = $this->data_model->getAll();

  $this->load->view("home",$data);

  
  
}
}
?&gt;

data_model.php (model)

Code:
&lt;?php

class Data_model extends CI_Model {

function getAll()
{

  $q = $this->db->query("SELECT * FROM data");
  if($q->num_rows() > 0)
  {
   foreach($q->result() as $row)
   {
    $data[] = $row;
   }
   return $data;
  }  

}

}
?&gt;

When I try to run this, nothing appears on the screen and I think it is an error in the code, but I don't know which type of error it is, because there is no error messages.

Anyone who can help me?