CodeIgniter Forums
Fatal error on model - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Fatal error on model (/showthread.php?tid=42307)



Fatal error on model - El Forum - 06-03-2011

[eluser]JasmineFlower[/eluser]
Hi,

I am using codeigniter 2.0.1.
I got an error on my model.

Code:
<?php  (defined('BASEPATH')) OR exit('No direct script access allowed');

class Register_model extends CI_Model
{    
    function Register_model()
        {
                parent::CI_Model();
        }
    public function individual_user_registration($table_name)
    {
        $this->db->select($table_name);
    }
        
}
?>


error: Fatal error: Call to undefined method CI_Model::CI_Model() in C:\xampp\htdocs\icadnxgen\icad_app\models\register_model.php on line 7

how to solve this problem?


Fatal error on model - El Forum - 06-03-2011

[eluser]John_Betong_002[/eluser]
 
http://ellislab.com/codeigniter/user-guide/general/models.html
 
 


Fatal error on model - El Forum - 06-03-2011

[eluser]InsiteFX[/eluser]
If you read the CodeIgniter User Guide you would have known this!
Code:
<?php  (defined('BASEPATH')) OR exit('No direct script access allowed');

class Register_model extends CI_Model
{    
    function __construct()
        {
                parent::__construct();
        }
    public function individual_user_registration($table_name)
    {
        $this->db->select($table_name);
    }
        
}
?>

InsiteFX


Fatal error on model - El Forum - 06-03-2011

[eluser]JasmineFlower[/eluser]
Hi,

I defined construct method,Its working now.Thank u