Welcome Guest, Not a member yet? Register   Sign In
codeigniter 2.0 problem with model
#1

[eluser]kris10[/eluser]
I got an error on my model

Fatal error: Call to undefined method CI_Model::Model() in /home/cb/public_html/1/radiomotion/application/models/media_model.php on line 8

Code:
<?php
class Media_model extends CI_Model{

function Media_model()
    {
        // Call the Model constructor
        parent::Model();
    }

/*  =========== Ajout ========================= */
    function addMedia(){

              $data = array('med_titre' => $_POST['med_titre']
                    );
    
      $this->db->insert('media',$data);
    
    }
    
    
}


?>

line 8 is parent::Model();

What did I forget ?
#2

[eluser]WanWizard[/eluser]
That the parent class isn't called "Model", it's called "CI_Model".
#3

[eluser]kris10[/eluser]
OK thanks I could find it myself
#4

[eluser]Sumon[/eluser]
Replace
Code:
parent::Model();
By
Code:
parent::__construct();




Theme © iAndrew 2016 - Forum software by © MyBB