Précédent   Forum des professionnels en informatique > PHP > Langage > Débuter
Débuter Forum d'entraide pour débuter en PHP. Avant de poster -> Cours PHP, FAQ PHP, Outils PHP, etc.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 17/12/2010, 17h39   #1
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
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 :
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 :
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 :
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:

Citation:
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
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 18/12/2010, 14h57   #2
Membre expérimenté
 
Avatar de amoiraud
 
Homme Adrien
Développeur Web
Inscription : octobre 2006
Messages : 405
Détails du profil
Informations personnelles :
Nom : Homme Adrien
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 : 405
Points : 531
Points : 531
Envoyer un message via MSN à amoiraud
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 :
1
2
 
<form method="post" action ="<?php echo $this->url{array('action' => 'Selectionner', 'id' => $this->employe->id_vente)};  ?>" >
amoiraud est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/12/2010, 15h09   #3
Membre actif
 
Avatar de speedy_g
 
Inscription : avril 2007
Messages : 210
Détails du profil
Informations personnelles :
Âge : 31
Localisation : Belgique

Informations forums :
Inscription : avril 2007
Messages : 210
Points : 178
Points : 178
Et,

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

je verrais plutot une parenthèse
speedy_g est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 19/12/2010, 22h50   #4
Membre expérimenté
 
Avatar de amoiraud
 
Homme Adrien
Développeur Web
Inscription : octobre 2006
Messages : 405
Détails du profil
Informations personnelles :
Nom : Homme Adrien
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 : 405
Points : 531
Points : 531
Envoyer un message via MSN à amoiraud
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
amoiraud est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/12/2010, 10h28   #5
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
Bonjour,

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

Citation:
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?
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 20/12/2010, 23h42   #6
Membre Expert
 
Avatar de nosferapti
 
Inscription : avril 2009
Messages : 1 157
Détails du profil
Informations forums :
Inscription : avril 2009
Messages : 1 157
Points : 1 129
Points : 1 129
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 !
nosferapti est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 10h13   #7
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
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 :
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 :
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 :
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
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 10h50   #8
Rédacteur/Modérateur
 
Avatar de MaitrePylos
 
Homme Gérard Ernaelsten
DBA & Dev PHP
Inscription : juin 2005
Messages : 3 174
Détails du profil
Informations personnelles :
Nom : Homme Gérard Ernaelsten
Âge : 39
Localisation : Belgique

Informations professionnelles :
Activité : DBA & Dev PHP
Secteur : Service public

Informations forums :
Inscription : juin 2005
Messages : 3 174
Points : 6 460
Points : 6 460
Bonjour,
Il me semble que fetchRow nze retourne qu'un ligne non ?
Code :
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 :
1
2
3
4
 
  foreach($this->employe as $employe) {									   
$this->$employe->id_vente	      
}
tu dois donc enlever le $this

Code :
1
2
 
$employe->id_vente
En passant es tu sûr de récupérer tes données en Object ?
MaitrePylos est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 11h26   #9
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
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 :
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>
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 11h36   #10
Rédacteur/Modérateur
 
Avatar de MaitrePylos
 
Homme Gérard Ernaelsten
DBA & Dev PHP
Inscription : juin 2005
Messages : 3 174
Détails du profil
Informations personnelles :
Nom : Homme Gérard Ernaelsten
Âge : 39
Localisation : Belgique

Informations professionnelles :
Activité : DBA & Dev PHP
Secteur : Service public

Informations forums :
Inscription : juin 2005
Messages : 3 174
Points : 6 460
Points : 6 460
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 :
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);
		}
 
 
}
MaitrePylos est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 13h11   #11
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
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:

Citation:
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 :
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>
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 14h52   #12
Rédacteur/Modérateur
 
Avatar de MaitrePylos
 
Homme Gérard Ernaelsten
DBA & Dev PHP
Inscription : juin 2005
Messages : 3 174
Détails du profil
Informations personnelles :
Nom : Homme Gérard Ernaelsten
Âge : 39
Localisation : Belgique

Informations professionnelles :
Activité : DBA & Dev PHP
Secteur : Service public

Informations forums :
Inscription : juin 2005
Messages : 3 174
Points : 6 460
Points : 6 460
Vous avez une erreur avec MySQL, il vous faut d'abord régler ce souci.
MaitrePylos est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 20h37   #13
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
Mais mon serveur mysql fonctionne bien j'accède sans problème dans ma base de donnée et mes tables.
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 21h00   #14
Membre expérimenté
 
Avatar de amoiraud
 
Homme Adrien
Développeur Web
Inscription : octobre 2006
Messages : 405
Détails du profil
Informations personnelles :
Nom : Homme Adrien
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 : 405
Points : 531
Points : 531
Envoyer un message via MSN à amoiraud
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
amoiraud est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 21h10   #15
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
Alors d'aprés ce code est-ce-que tu peux me dire ou est l'erreur?
Code :
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);
 
 
 
 
 
 
		}
 
 
}
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 21h21   #16
Membre expérimenté
 
Avatar de amoiraud
 
Homme Adrien
Développeur Web
Inscription : octobre 2006
Messages : 405
Détails du profil
Informations personnelles :
Nom : Homme Adrien
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 : 405
Points : 531
Points : 531
Envoyer un message via MSN à amoiraud
Je sait pas, peut tu faire un var_dump de la variable $result qui récupère le fetchRow ?
amoiraud est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 22h31   #17
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
J'ai appliqué : et voila ce qui m'a donné:
Citation:
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
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 21/12/2010, 22h55   #18
Membre expérimenté
 
Avatar de amoiraud
 
Homme Adrien
Développeur Web
Inscription : octobre 2006
Messages : 405
Détails du profil
Informations personnelles :
Nom : Homme Adrien
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 : 405
Points : 531
Points : 531
Envoyer un message via MSN à amoiraud
Bon alors fait nous voir le code de ta classe Vente
amoiraud est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/12/2010, 11h21   #19
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
Voila la classe Vente:
Code :
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 :
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));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
   }	      
 
   }
 
   ?>
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 22/12/2010, 16h00   #20
Membre à l'essai
 
Inscription : mars 2010
Messages : 213
Détails du profil
Informations forums :
Inscription : mars 2010
Messages : 213
Points : 23
Points : 23
Peut être le problème dans l'action index et voila le code:

Code :
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);
            }
} 
 
 
 
 
 
}
king_soft est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 04h01.


 
 
 
 
Partenaires

Hébergement Web