I am working with Model View Controller design pattern..I wrote a simple program,.I have created a model,a views and a controller.
I have made a database "helloworld" and a table 'data' within it..The database details like its username,password,database name are already incorporated into a file called "database.php", which is a file in the config folder.
My problem is I'm geting an error llike,
A PHP Error was encountered
Message: Undefined property: Helloworld_model::$db
Line Number: 16
Fatal error: Call to a member function get() on a non-object in /home/sarika/workspace/ci/system/application/models/helloworld_model.php on line 16
helloworld_model.php contains the following code
class Helloworld_model extends Model
// Call the Model constructor
//Query the data table for every record and row
$query = $this->db->get('data');
if ($query->num_rows() > 0)
//show_error('Database is empty!');
I don't know what to do to correct the error............If anyone knows how to correct it.. please help?