Sorry for the stupid question, but this is driving me crazy…
I have test_framework.php as follows:
<?php
class Test_framework extends CI_Controller{
function display_test(){
echo "loading model...";
$this -> load -> model('test_model');
echo "model loaded...";
}
}
?>
and test_model.php as follows:
<?php
class Test_model extends Model {
function get_all(){
$q = $this -> db -> query("SELECT * FROM users");
foreach($q -> result() as $row)
{
$data[] = $row;
}
return $data;
}
}
?>
When I go to my index.php/test_framework/display_test, I see “loading model…” but never “model loaded…”, and there are no errors (just a blank white page). What could be happening wrong here??
Well, first of all, your class naming are wrong. Moreover, you have to extend the parent model __construct();
Here you may set an echo to trace the loading of the model:
Edit: quoting from the manual:
The basic prototype (from the manual) is:
If you want to record the initialization of controllers and models and so on, instead of having them echo something on your page you can enable logging in application/config.php :