Welcome Guest, Not a member yet? Register   Sign In
Fatal error: Call to undefined method Annoncemodel ??
#1

[eluser]ludo31[/eluser]
Hello ;

I try to insert data in my database and there is an message error like this :

Code:
Fatal error: Call to undefined method Annoncemodel::addAnnonce() in C:\wamp\www\MonSite\application\controllers\annonce.php on line 150
Call Stack
# Time Memory Function Location
1 0.0009 394280 {main}( ) ..\index.php:0
2 0.0024 471248 require_once( 'C:\wamp\www\MonSite\system\core\CodeIgniter.php' ) ..\index.php:202
3 0.0661 4734832 call_user_func_array ( ) ..\CodeIgniter.php:359
4 0.0661 4734880 Annonce->do_upload( ) ..\CodeIgniter.php:359


my controller is like that and it calls model function :

Code:
class Annonce extends CI_Controller {
      */
       public  function do_upload ()
{
      

/* I try to create an array for my table */

  $annonce= array(
       'description'=>'je suis un essai de description',
       'prix'=>2000,
       'identifiant_categorie'=>12,
       'identifiant_ville'=>2,
       'identifiant_region'=>5,
       'identifiant_annonceur'=>7,
       'titre'=>'maison de dieu');
      
            
    
  
      
       $this->annoncemodel->addAnnonce($annonce);




}

}

and in my model : annoncemodel.php

Code:
class Annoncemodel extends CI_Model {

       public function __construct()
       {
            parent::__construct();
          
       }

/* ajout dans la table announce */
    
    public function addAnnonce ($annonce)
    {
    
         $this->db->insert('annonce', $annonce);
    }

}


I configure autoload

Code:
$autoload['model'] = array('site_model','genre_model','client_model','shopModel','annoncemodel');

but I don't know why it doesn't work




Theme © iAndrew 2016 - Forum software by © MyBB