Bonsoir tt le monde,
j'ai un probleme je voudrais modifier un employe mais quand j'execute il me donnee cette erreur je comprend pas pourquoi:Fatal error:j'ai utilise deux fonction la fonction read qui permet de recuperer les donne a partir de l'id et update qui fait la mise a jour voila le code:Call to a member function setcin() on a non-object in C:\wamp\www\Application\employe\update.php on line 6
page:manager.php
et voici la page update.php qui contient l'appel de la fonction:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 public function update(employe $employe){ $this->makes(); $this->st=$this->pdo->prepare("update employe set cin=:cin,nom_em=:nom_em,id_grade=:id_grade,id_affectation=:id_affectation,adress=:adress where id_em=:id_em"); $this->st->bindvalue(':cin',$employe->getcin(),pdo::PARAM_STR); $this->st->bindvalue(':nom_em',$employe->getnom_em(),pdo::PARAM_STR); $this->st->bindvalue(':id_grade',$employe->getid_grade(),pdo::PARAM_INT ); $this->st->bindvalue(':id_affectation',$employe->getid_affectation(),pdo::PARAM_INT ); $this->st->bindvalue(':adress',$employe->getadress(),pdo::PARAM_STR); $exe=$this->st->execute(); } public function read($id_em){ $this->makes(); $this->st=$this->pdo->prepare("select * from employe where id_em=:id_em"); $this->st->bindvalue(':id_em',$id_em,pdo::PARAM_INT ); $exe=$this->st->execute(); }
Et merci
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12 <?php include'manager.php'; $manager=new manager(); $co=$manager->read($_POST["id_em"]); $co->setcin($_POST["cin"]); $co->setnom_em($_POST["nom_em"]); $co->setid_grade($_POST["id_grade"]); $co->setid_affectation($_POST["id_affectation"]); $co->setadress($_POST["adress"]); $manager->update($co); ?>
Partager