IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage PHP Discussion :

Récupérer le nom et prenom de l'employé


Sujet :

Langage PHP

  1. #1
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut Récupérer le nom et prenom de l'employé
    Bonjour,

    j'ai crée un formulaire avec un liste déroulante qui récupère tous les employés(nom et prénom) de la table vente avec son id_vente dans la vue index.phtml,mais je veux récupérer le nom et prénom de l'employé vers la vue selectionner.phtml et voici mes codes:
    controleur:selectionnerAction
    Code php : 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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
     
    public function selectionnerAction() {
     
     
     
    $table = new Vente();
    	$select = $table->select()->from($table);
    	$users = $table->fetchAll($select);
     
    		$this->view->employe= $users;
     
    $idstatis=$this->_request->getParam('id', 0);
                    $this->view->stat=$idstatis;
    if($this->_request->isPost()) {
     
     
    			$employe=new Vente() ;	
                            $id_ventes=$this->_request->getParam('id');		
    			$where2='id_vente='.$id_ventes;
    			$this->view->employe=$employe->fetchRow($where2);
     
                         $employe1=new Vente() ;	
                         $select=$employe1->select()
                         ->from(array('vente')
     
     
     
    		}
     
     
    }
    la vue index.phtml:
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    <?php
    	$this->headTitle('~JAMAL~ Selection d\'un client ');
    ?>
    			<h4></h4>
     
         <h2>Statistiques des ventes par jour</h2>
    	       <fieldset><legend>Sélectionner l'employeur:</legend>
     
     
     
     
    <form method="post" action ="<?php echo $this->url{array('action'=>'Selectionner', 'id'=>$employe->id_vente)};  ?>" >											
     
     
     
             <table>
     
             <tr><td>
     
           <fieldset><legend> </legend> <table cellpadding="0" cellspacing="0" border="0">
              <h2> Sélectionner un employé : </h2>
     
    						<tr><td align="center"><?php echo $this->form->em;   ?></td >  </tr>
     
     
     
     
             </table> </fieldset>
              </td>
     
     
     
     
        <tr><td align="center"><?php echo $this->form->submit; ?></td ><td></td>		</tr>
     
     
             </table></form>
     
     
     
     
     
               </fieldset>
    la vue selectionner.phtml:
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    <?php
    	$this->headTitle('~Opticien ~ Statistiques des ventes par jour');
    	$this->setEncoding('UTF-8');
    	require_once 'persistances/Client.php';
    	require_once 'persistances/Vente.php';
    	require_once 'persistances/Mesure.php';
    ?>
     
    <?php $id = $this->stat;?>
    <?php if ($id ==null) : ?>
     
    			<h4></h4>
     
         <h2>Statistiques des ventes par jour</h2>
    	       <fieldset>
     
     
     
     
     
     
     
     
             <table>
     
             <tr><h3>Employé:<?php echo $this->escape($this->employe->nom_empv).' '.  $this->escape($this->employe->prenom_empv); ?></h3><td>
     
           <fieldset><legend> </legend> <table cellpadding="0" cellspacing="0" border="0">
              <h2>  </h2>
     
    						<tr><td align="center">   </td >  </tr>
     
     
     
     
             </table> </fieldset>
              </td>
     
     
     
     
        <tr><td align="center"></td ><td></td>		</tr>
     
     
             </table>
     
     
     
               <?php endif;?>
     
               </fieldset>
    mais durant l'éxecution voici ce qui me donne:

    Not Found

    The requested URL /Opticien/public/index.php/<br /><b>Notice</b>: Undefined variable: employe in <b>C:\wamp\www\Opticien\application\default\views\scripts\statis\index.phtml</b> on line <b>12</b><br /><br /><b>Notice</b>: Trying to get property of non-object in <b>C:\wamp\www\Opticien\application\default\views\scripts\statis\index.phtml</b> on line <b>12</b><br /> was not found on this server.
    Donc ici ou est le problème?
    Et merci pour vos réponses

  2. #2
    Membre éprouvé
    Avatar de amoiraud
    Homme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2006
    Messages
    606
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2006
    Messages : 606
    Points : 1 057
    Points
    1 057
    Par défaut
    Salut,
    $employe est une variable de vue, tu doit donc la préfixer par $this, essaye de mettre ca dans le fichier index.phtml :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <form method="post" action ="<?php echo $this->url{array('action' => 'Selectionner', 'id' => $this->employe->id_vente)};  ?>" >


    Les boutons et existent, servez-vous en

  3. #3
    Membre actif Avatar de speedy_g
    Profil pro
    Inscrit en
    Avril 2007
    Messages
    213
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Avril 2007
    Messages : 213
    Points : 242
    Points
    242
    Par défaut
    Et,

    est-ce que l'accolade est justifié dans $this->url{

    je verrais plutot une parenthèse

  4. #4
    Membre éprouvé
    Avatar de amoiraud
    Homme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2006
    Messages
    606
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2006
    Messages : 606
    Points : 1 057
    Points
    1 057
    Par défaut
    Citation Envoyé par speedy_g Voir le message
    Et,

    est-ce que l'accolade est justifié dans $this->url{

    je verrais plutot une parenthèse
    Effectivement je l'avais pas remarqué mais oui c'est une parenthèse


    Les boutons et existent, servez-vous en

  5. #5
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    Bonjour,

    J'ai appliqué le code écrit par amoiraud et voila ce qui m'a envoyé:

    Catchable fatal error: Object of class Zend_Db_Table_Row could not be converted to string in C:\wamp\www\Opticien\application\default\views\scripts\statis\index.phtml on line 12
    Ou est le problème donc?

  6. #6
    Membre chevronné Avatar de nosferapti
    Profil pro
    Inscrit en
    Avril 2009
    Messages
    1 157
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Avril 2009
    Messages : 1 157
    Points : 1 895
    Points
    1 895
    Par défaut
    Citation Envoyé par king_soft Voir le message
    Bonjour,

    J'ai appliqué le code écrit par amoiraud et voila ce qui m'a envoyé:



    Ou est le problème donc?
    montre nous le contenu de index.phtml que tu as maintenant
    GNAP !

  7. #7
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    nosferapti,

    J'ai déjà résolu cette erreur,mais pour le cœur du problème: je veux récupérer le nom et prenom de l'employé vers la vue selectionner.phtml à partir de la vue index.phtml


    Voila donc les codes:
    l'action selectionner:
    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
     
    public function selectionnerAction() {
     
     
     
     
        if($this->_request->isPost()) {
    			$employe=new Employe() ;
    			$id_vente=$this->_request->getParam('id');
    			$where='id_vente='.$id_vente;
    			$this->view->employe=$employe->fetchRow($where);
    		}
     
     
    }
    la vue inex.phtml
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
     <?php
    	$this->headTitle('~JAMAL~ Selection d\'un client ');
    ?>
    			<h4></h4>
     
         <h2>Statistiques des ventes par jour</h2>
    	       <fieldset><legend>Sélectionner l'employeur:</legend>
     
     
    	<?php
     
    	                 foreach($this->employe as $employe) {										
     
    <form method="post" action ="<?php echo $this->url(array('action'=>'Selectionner', 'id'=>$this->$employe->id_vente)};  ?>" >											
     
                 <?php } ?>
     
             <table>
     
             <tr><td>
     
           <fieldset><legend> </legend> <table cellpadding="0" cellspacing="0" border="0">
              <h2> Sélectionner un employé : </h2>
     
    						<tr><td align="center"><?php echo $this->form->em;   ?></td >  </tr>
     
     
     
     
             </table> </fieldset>
              </td>
     
     
     
     
        <tr><td align="center"><?php echo $this->form->submit; ?></td ><td></td>		</tr>
     
     
             </table></form>
     
     
     
     
     
               </fieldset>
    la vue selectionner.phtml:
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
     
     
    <?php
    	$this->headTitle('~Opticien ~ Statistiques des ventes par jour');
    	$this->setEncoding('UTF-8');
    	require_once 'persistances/Client.php';
    	require_once 'persistances/Vente.php';
    	require_once 'persistances/Mesure.php';
    ?>
     
     
     
    			<h4></h4>
     
         <h2>Statistiques des ventes par jour</h2>
    	       <fieldset>
     
     
     
     
     
     
     
     
             <table>
            <?php
     
    	                 foreach($this->employe as $employe) {	
             <tr><h3>Employé:<?php echo $this->escape($this->employe->nom_empv).' '.  $this->escape($this->employe->prenom_empv); ?></h3><td>
              <?php } ?>
           <fieldset><legend> </legend> <table cellpadding="0" cellspacing="0" border="0">
              <h2>  </h2>
     
    						<tr><td align="center">   </td >  </tr>
     
     
     
     
             </table> </fieldset>
              </td>
     
     
     
     
        <tr><td align="center"></td ><td></td>		</tr>
     
     
             </table>
     
     
     
     
     
               </fieldset>
    Et merci pour vos réponses

  8. #8
    Modérateur

    Avatar de MaitrePylos
    Homme Profil pro
    DBA
    Inscrit en
    Juin 2005
    Messages
    5 496
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 496
    Points : 12 596
    Points
    12 596
    Par défaut
    Bonjour,
    Il me semble que fetchRow nze retourne qu'un ligne non ?
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $this->view->employe=$employe->fetchRow($where);
    Dans ta vue tu fais un foreach mais tu n'utilise pas la variable instancié dans ce foreach

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
     
      foreach($this->employe as $employe) {									   
    $this->$employe->id_vente	      
    }
    tu dois donc enlever le $this

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    $employe->id_vente
    En passant es tu sûr de récupérer tes données en Object ?

  9. #9
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    MaitrePylos,

    J'ai appliqué votre code dans index.phtml,mais toujours le même problème,je n'arrive plus à trouver l'origine du problème,voici donc mon index.phtml:
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    <?php
    	$this->headTitle('~JAMAL~ Selection d\'un client ');
            require_once 'persistances/Client.php';
    	require_once 'persistances/Vente.php';
    	require_once 'persistances/Mesure.php';
    ?>
     
     
    			<h4></h4>
     
         <h2>Statistiques des ventes par jour</h2>
    	       <fieldset><legend>Sélectionner l'employeur:</legend>
     
     
     
     
     
     
     
    <?php
     
    	                 foreach($this->employe as $employe) { 
    $employe->id_vente;
     ?>
     
     
    <form method="post" action ="<?php  echo $this->url(array('action'=>'selectionner', 
     
    'id'=>$employe->id_vente)); ?>"> <?php } ?>							
     
     
     
     
     
             <table>
     
             <tr><td>
     
     
           <fieldset><legend> </legend> <table cellpadding="0" cellspacing="0" border="0">
              <h2> Sélectionner un employé : </h2>
     
    						<tr><td align="center"><?php echo $this-
     
    >form->em;   ?></td >   </tr>
     
     
     
     
             </table> </fieldset>
              </td>
     
     
     
     
        <tr><td align="center"><?php echo $this->form->submit; ?></td ><td></td>		
     
    </tr>
     
             </table></form>
     
     
     
     
     
               </fieldset>

  10. #10
    Modérateur

    Avatar de MaitrePylos
    Homme Profil pro
    DBA
    Inscrit en
    Juin 2005
    Messages
    5 496
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 496
    Points : 12 596
    Points
    12 596
    Par défaut
    La vue ne doit-pas être index.phtml mais selectionner.phtml.

    Dans votre controller, ajouter ce code et dite moi ce que cela retourne


    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
     
    public function selectionnerAction() {
     
     
        if($this->_request->isPost()) {
    			$employe=new Employe() ;
    			$id_vente=$this->_request->getParam('id');
    			$where='id_vente='.$id_vente;
                            $result = $employe->fetchRow($where);
    			$this->view->employe= $result;
                            Zend_Debug::dump($result);
    		}
     
     
    }

  11. #11
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    MaitrePylos,

    J'ai appliqué votre code,et pour la table c'est vente($employe=new Vente)c'est pas employe,voila ce qui m'a donné dans l'éxecution:

    Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1' in C:\wamp\www\Opticien\library\Zend\Db\Statement\Pdo.php:228 Stack trace: #0 C:\wamp\www\Opticien\library\Zend\Db\Statement\Pdo.php(228): PDOStatement->execute(Array) #1 C:\wamp\www\Opticien\library\Zend\Db\Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array) #2 C:\wamp\www\Opticien\library\Zend\Db\Adapter\Abstract.php(468): Zend_Db_Statement->execute(Array) #3 C:\wamp\www\Opticien\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select), Array) #4 C:\wamp\www\Opticien\library\Zend\Db\Table\Abstract.php(1505): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Table_Select)) #5 C:\wamp\www\Opticien\library\Zend\Db\Table\Abstract.php(1367): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Selec in C:\wamp\www\Opticien\library\Zend\Db\Statement\Pdo.php on line 234
    et en plus voila mon code selectionner.phtml:

    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
      <?php
    	$this->headTitle('~Opticien ~ Statistiques des ventes par jour');
    	$this->setEncoding('UTF-8');
    	require_once 'persistances/Client.php';
    	require_once 'persistances/Vente.php';
    	require_once 'persistances/Mesure.php';
    ?>
     
     
     
    			<h4></h4>
     
         <h2>Statistiques des ventes par jour</h2>
    	       <fieldset>
     
     
     
     
     
     
     
     
             <table>
     
     
          <?php
     
    	                 foreach($this->employe as $employe) { 
    $employe->id_vente;
     ?>
     
             <tr><h3>Employé:<?php echo $this->escape($this->employe->nom_empv); ?
     
    ></h3><td><?php } ?>
     
     
           <fieldset><legend> </legend> <table cellpadding="0" cellspacing="0" border="0">
              <h2>  </h2>
     
    						<tr><td align="center">   </td >  </tr>
     
     
     
     
             </table> </fieldset>
              </td>
     
     
     
     
        <tr><td align="center"></td ><td></td>		</tr>
     
     
             </table>
     
     
     
     
     
               </fieldset>

  12. #12
    Modérateur

    Avatar de MaitrePylos
    Homme Profil pro
    DBA
    Inscrit en
    Juin 2005
    Messages
    5 496
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 51
    Localisation : Belgique

    Informations professionnelles :
    Activité : DBA
    Secteur : Service public

    Informations forums :
    Inscription : Juin 2005
    Messages : 5 496
    Points : 12 596
    Points
    12 596
    Par défaut
    Vous avez une erreur avec MySQL, il vous faut d'abord régler ce souci.

  13. #13
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    Mais mon serveur mysql fonctionne bien j'accède sans problème dans ma base de donnée et mes tables.

  14. #14
    Membre éprouvé
    Avatar de amoiraud
    Homme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2006
    Messages
    606
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2006
    Messages : 606
    Points : 1 057
    Points
    1 057
    Par défaut
    Citation Envoyé par king_soft Voir le message
    Mais mon serveur mysql fonctionne bien j'accède sans problème dans ma base de donnée et mes tables.
    Le probleme ne vient pas du serveur, c'est une erreur de synthaxe dans une requête


    Les boutons et existent, servez-vous en

  15. #15
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    Alors d'aprés ce code est-ce-que tu peux me dire ou est l'erreur?
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
     
    public function selectionnerAction() {
     
     
     
    if($this->_request->isPost()) {
                            $employe=new Vente() ;
    			$id_vente=$this->_request->getParam('id');
    			$where='id_vente='.$id_vente;
                            $result = $employe->fetchRow($where);
    			$this->view->employe= $result;
                            Zend_Debug::dump($result);
     
     
                             //$employe=new Vente() ;
    			//$id_vente=$this->_request->getParam('id');
    			//$where='id_vente='.$id_vente;
    			//$this->view->employe=$employe->fetchRow($where);
     
     
     
     
     
     
    		}
     
     
    }

  16. #16
    Membre éprouvé
    Avatar de amoiraud
    Homme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2006
    Messages
    606
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2006
    Messages : 606
    Points : 1 057
    Points
    1 057
    Par défaut
    Je sait pas, peut tu faire un var_dump de la variable $result qui récupère le fetchRow ?


    Les boutons et existent, servez-vous en

  17. #17
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    J'ai appliqué : et voila ce qui m'a donné:
    Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') LIMIT 1' at line 1' in C:\wamp\www\Opticien\library\Zend\Db\Statement\Pdo.php:228 Stack trace: #0 C:\wamp\www\Opticien\library\Zend\Db\Statement\Pdo.php(228): PDOStatement->execute(Array) #1 C:\wamp\www\Opticien\library\Zend\Db\Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array) #2 C:\wamp\www\Opticien\library\Zend\Db\Adapter\Abstract.php(468): Zend_Db_Statement->execute(Array) #3 C:\wamp\www\Opticien\library\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query(Object(Zend_Db_Table_Select), Array) #4 C:\wamp\www\Opticien\library\Zend\Db\Table\Abstract.php(1505): Zend_Db_Adapter_Pdo_Abstract->query(Object(Zend_Db_Table_Select)) #5 C:\wamp\www\Opticien\library\Zend\Db\Table\Abstract.php(1367): Zend_Db_Table_Abstract->_fetch(Object(Zend_Db_Table_Selec in C:\wamp\www\Opticien\library\Zend\Db\Statement\Pdo.php on line 234

  18. #18
    Membre éprouvé
    Avatar de amoiraud
    Homme Profil pro
    Développeur Web
    Inscrit en
    Octobre 2006
    Messages
    606
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Octobre 2006
    Messages : 606
    Points : 1 057
    Points
    1 057
    Par défaut
    Bon alors fait nous voir le code de ta classe Vente


    Les boutons et existent, servez-vous en

  19. #19
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    Voila la classe Vente:
    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
     
    <?php
    class Vente extends Zend_Db_Table
    {
        protected $_name = 'vente';
        protected $_primary = 'id_vente';
     
         protected $_referenceMap = array('idcli'=>array('columns'=>array('id_cli'),'refTableClass'=>'Client','refColumns'=>array('id_cli'),'onDelete'=>self::CASCADE),
     
    						              'refarticle'=>array('columns'=>array('id_produit'),'refTableClass'=>'Produit','refColumns'=>array('id_produit'),'onDelete'=>self::CASCADE),
                                          'idemp'=>array('columns'=>array('id_emp'),'refTableClass'=>'Employe','refColumns'=>array('id_emp'),'onDelete'=>self::CASCADE));
     
     
    }
    ?>
    et aussi voila le code de StatisFormulaire.php:
    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
     <?php	
     
     
    require_once 'persistances/Docteur.php';
    require_once 'persistances/Employe.php';
    require_once 'persistances/Client.php';
    require_once 'persistances/Mesure.php';
    require_once 'persistances/Vente.php';
     
      require_once 'composants/Zend_InputText.php';
    	require_once 'composants/Zend_Select.php';
    	require_once 'composants/Zend_Multiselect.php';
    	require_once 'composants/Zend_InputFile.php';
    	require_once 'composants/Zend_InputSubmit.php';
     
     
     
     
     
     
     
    class StatisFormulaire extends Zend_Form
    {
        public function __construct($options = null)
        {
            parent::__construct($options);
            $this->setName('vente');
            $id = new Zend_Form_Element_Hidden('id_vente');
     
     
     
     
     
     
     
    $employe         = new Vente();
          $all             = $employe->fetchAll();
          $nomTab          = array();
          $nomTab2          = array();
     
          foreach ($all as $a) {
              $nomTab[$a->id_vente] = $a->nom_empv.' '.$a->prenom_empv.' '.$a->id_vente ;
               $nomTab2[$a->id_vente] = $a->id_vente ;
     
     
          }
     
     
          $em = new Zend_Form_Element_Select('em');
          $em->setLabel('Employe:');
          $em->setMultiOptions($nomTab);
          $em->setRequired(true);
     
          $em->addValidator(new Zend_Validate_Int());
     
        echo $nomTab2[$a->id_vente];
    $submit = new Zend_Form_Element_Submit('submit');
    $submit->setAttrib('id', 'submitbutton');
     $this->addElements(array($id, $em));
      $this->addElements(array($id, $submit));
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
       }	      
     
       }
     
       ?>

  20. #20
    Membre du Club
    Inscrit en
    Mars 2010
    Messages
    233
    Détails du profil
    Informations forums :
    Inscription : Mars 2010
    Messages : 233
    Points : 53
    Points
    53
    Par défaut
    Peut être le problème dans l'action index et voila le code:

    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
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
      public function indexAction() 
        {
     
    $table = new Vente();
    	$select = $table->select()->from($table);
    	$users = $table->fetchAll($select);
     
    		$this->view->employe= $users;
     
    $this->view->title = "Selectionner un employé";
     
    $form = new StatisFormulaire();    
     
            $form->submit->setLabel('Selectionner');
            $this->view->form = $form;
            if ($this->_request->isPost()) {
                $formData = $this->_request->getPost();
     
     
     
     
                if ($form->isValid($formData)) {
     
     
     
                	$emp = new Vente();
     
                    $em= $form->getValue('em');
     
     
                 $emp = new Vente();
     
     
     
    				$id1 = (int)$form->getValue('em');
     
    				$select = $emp->select()->from($emp,
                  	'nom_empv')->where('id_vente=?',$id1);   
     
    			    $res = $emp->fetchAll($select);
     
                    foreach ($res as $r) {
                   $nomempv= $r->nom_empv;
     
     
     
                    }
     
                    //$doc2 = new Docteur();
     
                $id2 = (int)$form->getValue('em');
     
    				$select = $emp->select()->from($emp,
                  	'prenom_empv')->where('id_vente=?',$id2);   
     
    			    $res = $emp->fetchAll($select);
     
                    foreach ($res as $r) {
                   $prenomempv= $r->prenom_empv;                              
     
                    }				
     
     
     
     
                    $emp = new Vente();
     
                 $row01 = $emp->createRow();
                   $row01->nom_empv= "$nomempv";
                   $row01->prenom_empv= "$prenomempv";
     
    $dernier = new Dernierid();
     
     
     
     
     
                $dercl         = new Dernierid();
          $all             = $dercl->fetchAll();       
          $nomTab          = array();
     
          foreach ($all as $a) {
              $nomTab[$a->id_derid] = $a->id_dc;
          }
     
     
    			$id_dcc=$nomTab[$a->id_derid];	
     
     
     
     
     
    			$derm         = new Dernierid();
          $allm             = $derm->fetchAll();       
          $nomTabm          = array();
     
          foreach ($allm as $a) {
              $nomTabm[$a->id_derid] = $a->id_dm;
          }
     
     
    			$id_dmm=$nomTabm[$a->id_derid];	
     
     
     
     
     
     
    			$derv        = new Dernierid();
          $allv             = $derv->fetchAll();       
          $nomTabv          = array();
     
          foreach ($allv as $a) {
              $nomTabv[$a->id_derid] = $a->id_dv;
          }
     
     
    			$id_dvv=$nomTabv[$a->id_derid];	
     
     
                   //$row01->save();
     
                   $this->_redirect('/statis/selectionner');
    }
    else {
                    $form->populate($formData);
                }
    } 
     
     
     
     
     
    }

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Comment récupérer le nom du fichier sans l'extension ?
    Par altahir007 dans le forum Langage
    Réponses: 16
    Dernier message: 13/11/2009, 14h20
  2. Réponses: 10
    Dernier message: 21/02/2007, 21h16
  3. Récupérer le nom de domaine d'appartenance d'un serveur
    Par Laurent Dardenne dans le forum Windows
    Réponses: 2
    Dernier message: 26/01/2004, 18h01
  4. Récupérer le nom de l'utilisateur sous linux
    Par Michaël dans le forum POSIX
    Réponses: 7
    Dernier message: 25/12/2003, 22h38
  5. Récupérer le nom de la machine locale
    Par Jflgb dans le forum C++Builder
    Réponses: 5
    Dernier message: 15/05/2003, 10h25

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo