Rechercher avec une condition

Par hdfs99, il y a 8 ans


Bonsoir tt le monde,
j'ai un problème je voudrais recherche un employè a partir de son id.
voila ma fonction:

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 voila l'appel de la fonction:

<?php include "manager.php"; $manager=new manager(); $exe=$manager->read($_POST['id_em']); $exe->setnom_em($_POST['nom_em']); $exe->setnum_em($_POST['num_em']); ?>

et voila mon formulaire:

<form method="post"action="appel1.php"> <select name="id_em"> <?php try { $obj1=new PDO('mysql:host=localhost;dbname=gestion;charset=utf8','root',''); } catch (Exception $e) { die('ERREUR : '.$e->getMessage()); } $res= $obj1->query('select * from employe'); while ($ligne=$res->fetch()) {?> <option value="<?php echo $ligne['id_em']; ?>" > <?php echo $ligne['id_em']; ?> </option> <?php } $res->closeCursor(); ?> <input type="text" name="nom_em"> <input type="text"name="num_em"> <input type="submit"value="ok"> </select> </form>

je veux quand je sélectionne un id employé(id_em)il me retourne les information de l’employé.
Je suis bloque si quelqu'un peut m'aider.
ET merci pour vos reponses

2 réponses

kwik, il y a 8 ans

Bonjour

Ta fonction read est censé retourne les informations de l'utilisateur ? Dans ton cas ta fonction ne fait qu'une requête sans retourné de données :)

hdfs99, il y a 8 ans

Merci kwik