[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>";
}
?>
site.php (controller)
Code:
<?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);
}
}
?>
data_model.php (model)
Code:
<?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;
}
}
}
?>
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?