Pauvez vous m'aider SVP ?
Losque j'essai d'executer une requete parametrée je reçoi le message suivant
getConsencais SQLSTATE[HY093]: Invalid parameter number: no parameters were bound
NB: Le parametre est la valeur selectionnée dans la liste déroulante au niveau du formulaire

Modéle
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
 
 
<?php
class Admin_Model_DbTable_Consencai extends Zend_Db_Table_Abstract {
    protected $_name    = 'tconsencai';
    protected $_primary = 'id_consencai';
 
    public function getConsencais($libelgroupe = NULL)  {
        try {
            return $this->fetchAll($this->select()
                                        ->where('libel_groupe_consencai = ?', $libelgroupe));
        }
        catch (Exception $e) {
            echo "getConsencais<br />";
            echo $e->getMessage();
            exit;
        }
    }
}
Vue de formulaire
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<form action="<?php echo $this->escape($this->element->getAction()); ?>"
      method="<?php echo $this->escape($this->element->getMethod()); ?>"
      name="<?php echo $this->escape($this->element->getAttrib('name')); ?>"
      class="formconscours">
 
	<TABLE WIDTH=50%>
		<tr>
			<td align="center"><b>Veuillez choisir le groupe adequoat :</b></td>
			<td><?php echo $this->element->libelgroupe->renderViewHelper(); ?></td>
			<td align="center"><?php echo $this->element->valider->renderViewHelper(); ?></td>
			<td align="center">&nbsp;&nbsp;<?php echo $this->element->annuler->renderViewHelper(); ?></td>
		</tr>
	</table>
</form>
Controller
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
<?php
class Admin_ConsencaiController extends Zend_Controller_Action {
    protected $urlRetour  = '/admin/index/';
    protected $nbreLignes   = 15;
 
       public function init()   {
        $action = $this->_request->getActionName();
 
        if ($action == 'index') {
            $this->view->headLink()
                       ->appendStylesheet($this->view->baseUrl().'/styles/pagination.css');
        }
    }
       public function indexAction()     {
 
		$session        = new Zend_Session_Namespace('Consultation');
		$libelgroupe    = $session->groupe    ;
 
		$ConsmoisTab      = new Admin_Model_DbTable_Consencai();
        $ConsmoisRows     = $ConsmoisTab->getConsencais();
        $numPage    = $this->_request->getParam('numpage', 1);
 
        $page       = Zend_Paginator::factory($ConsmoisRows);
        $page->setPageRange(5)
             ->setCurrentPageNumber($this->_getParam('page', $numPage))
             ->setItemCountPerPage($this->_getParam('par', $this->nbreLignes));
 
        $this->view->liste      = $page;
        $this->view->numPage    = $numPage;
    }
        public function afficherAction()     {
        $this->view->headLink()
                   ->appendStylesheet($this->view->baseUrl().'/styles/formlogin.css');
        $form                   = new Admin_Form_Conscours();
        $form->valider->setLabel('Consultation par groupe');
        $meserr     = '';
        $champFocus = 'libel_groupe';
 
         $request = $this->getRequest();
 
 
         if ($request->isPost()) {
             if ($form->isValid($request->getPost())) {
				Zend_Loader::loadClass('Zend_Filter_StripTags');
				$filter = new Zend_Filter_StripTags();
				$libelgroupe=trim($filter->filter($this->getRequest()->getPost('libelgroupe')));
				$session = new Zend_Session_Namespace('Consultation') ;
				$session->groupe = $libelgroupe ; 
				$this->_forward("index");
			}
		}
	    $this->view->form       = $form;
    $this->view->message    = '';
	}
}
Formulaire
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
<?php
class Admin_Form_Conscours extends Zend_Form {
 
      public function init()     {
        $this->setMethod('post')
             ->setName('consultationcours')
             ->setAttrib('name', 'conscours');
        $groupeTab   = new Admin_Model_DbTable_Groupe();
        $groupeRows  = $groupeTab->getGroupes();
        $groupes     = array();
 
        foreach ($groupeRows as $row) {
            $groupes[$row->id_groupe] = $row->libel_groupe;
        }
 
        $groupe  = new Zend_Form_Element_Select('libelgroupe');
        $groupe->setLabel('Groupe : ')
                  ->setMultiOptions($groupes)
                  ->setValue(0)
                  ->getDecorator('label')->setOption('tag', NULL);
        $this->addElement($groupe);
        $valider    = new Zend_Form_Element_Submit('valider');
        $valider->setIgnore(TRUE);
        $this->addElement($valider);
 
        $annuler    = new Zend_Form_Element_Submit('annuler');
        $annuler->setLabel('Annuler')
        	->setIgnore(TRUE);
        $this->addElement($annuler);
 
        $this->setDecorators(array(array('ViewScript',
                             array('viewScript' => 'consencaiscript.phtml'))));
    }
}
la vue:
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
<h2>Consultation des Encaissement par mois</h2>
<div align="center">
    <table>
        <tr>
            <th>Numero</th>
            <th>Professeur</th>
            <th>Eleve</th>
            <th>Groupe</th>
            <th>Montant regle</th>
            <th>Date</th>
        </tr>
 
        <?php foreach ($this->liste as $infoEncaissement) { ?>
        <tr>
            <td align="center">
                <?php echo $infoEncaissement->id_consencai; ?>
            </td>
            <td>
                <?php echo $infoEncaissement->np_professeur; ?>
            </td>
            <td align="center">
                <?php echo $infoEncaissement->np_eleve_consencai; ?>
            </td>
            <td align="center">
                <?php echo $infoEncaissement->libel_groupe_consencai; ?>
            </td>
            <td>
                <?php echo $infoEncaissement->montantregle_consencai; ?>Dhs
            </td>
            <td align="right">
                <?php echo $infoEncaissement->dtreglement_consencai; ?>Dhs
            </td>
        </tr>
        <?php } ?>
    </table>
</div>