Categories > TinyButStrong general (FR) >

Affichage par page

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: al
Date: 2008-09-12
Time: 09:44

Affichage par page

Bonjour,

j'utilise tbs et j'ai un problème avec l'affichage par page.
en fait, quand on fait un SELECT * FROM table ça marche bien mais lorsque j'utilise une condition WHERE la seconde page n'affiche rien

voici mon code :
Html
<table width="550" border="0" cellspacing="0" cellpadding="0">
             
              <tr>
                <td width="20" class="Normal">Zone:</td>
                <td width="159">
                <select name="zone" class="inputliste" id="zone" >
                    <option value="0">Zone</option>
                   <option value="[listzn.num_client;block=option]">[listzn.num_client]</option>
                </select>
                </td>
                <td width="74" class="Normal">Cat&eacute;gorie:</td>
                <td width="159"><select name="cat" class="inputliste" id="cat"  >
                    <option value="0"></option>
                    <option value="[listcat.code_cat;block=option]">[listcat.code_cat]</option>
                  </select>                </td>
                <td width="74" class="Normal">Mois:</td>
                <td width="159"><select name="mois" class="inputliste" id="mois"  >
                    <option value="0"></option>
                    <option value="01">Janvier</option>
                    <option value="02">Fevrier</option>
                    <option value="03">Mars</option>
                    <option value="04">Avril</option>
                    <option value="05">Mai</option>
                    <option value="06">Juin</option>
                    <option value="07">Juillet</option>
                    <option value="08">Août</option>
                    <option value="09">Septembre</option>
                    <option value="10">Octobre</option>
                    <option value="11">Novembre</option>
                    <option value="12">Decembre</option>
                   
                  </select>                </td>
                  <td >&nbsp;
               
                 </td>
                 <td >
                <input type="text" value="" id="an" name="an" width="4">
                 </td>
                 <td width="10">&nbsp;
                      
                 </td>
                  <td width="30">
                <input type="submit"value="Rechercher" id="find" name="find" width="10">
                 </td>
                
              </tr>
              <tr>
                <td width="74">&nbsp;</td>
                <td width="159">&nbsp;</td>
              </tr>
            </table>

<table border="1" align="center" cellpadding="2" cellspacing="0">
          <tr align="center">
            <td width="16"><a href="index.php?w=administration&f=dcomm.php&act=find&PageNum=[nv.first;endpoint;magnet=a;mtype=m+m]">|&lt;</a></td>
            <td width="16"><a href="index.php?w=administration&f=dcomm.php&act=find&PageNum=[nv.prev;endpoint;magnet=a;mtype=m+m]">&lt;</a></td>
            <td width="16"><a href="index.php?w=administration&f=dcomm.php&act=find&PageNum=[nv.page;block=td;navsize=2;navpos=centred]">[nv.page]</a></td>
            <td width="16" bgcolor="#C4E1E1"><strong>[nv.page;block=td;currpage]</strong></td>
            <td width="16"><a href="index.php?w=administration&f=dcomm.php&act=find&PageNum=[nv.next;endpoint;magnet=a;mtype=m+m]">&gt;</a></td>
            <td width="16"><a href="index.php?w=administration&f=dcomm.php&act=find&PageNum=[nv.last;endpoint;magnet=a;mtype=m+m]">&gt;|</a></td>
          </tr>
</table>

Script
        $zone=$_POST['zone'];
        $cat=$_POST['cat'];
        $mois=$_POST['mois'];
        $an=$_POST['an'];
        echo $mois.'/'.$an.'<br>';
       
        if (!isset($_GET)) $_GET=&$HTTP_GET_VARS ;
            if (isset($_GET['PageNum'])) {
               $PageNum = $_GET['PageNum'] ;
            } else {
              $PageNum = 1 ;
            }
           
            //Default value
            if (isset($_GET['RecCnt'])) {
               $RecCnt = intval($_GET['RecCnt']) ;
            } else {
              $RecCnt = -1 ;
            } 
           
        $PageSize = 35;
    
        $TBS->LoadTemplate(TPL_DGAA_PATH.'dcomm_fact_result_find.htm') ;
   
         $TBS->PlugIn(TBS_BYPAGE,$PageSize,$PageNum,$RecCnt); // Le prochain bloc sera fusionné en mode
        $TBS->Plugin(TBS_NAVBAR,'nv',array('size'=>35,'pos'=>'centred'),$PageNum,$RecCnt,$PageSize) ;
        $RecCnt = $TBS->MergeBlock('view,view0',$cnx_id,"SELECT * FROM facture WHERE mois_fact='$mois'AND an_fact='$an'
        AND code_cat='$cat' ");       
        $TBS->MergeBlock('listcat',$cnx_id,'SELECT distinct code_cat FROM facture');
        //$TBS->MergeBlock('listzn',$cnx_id,'SELECT substr(num_client,1,2) FROM facture');
               
Merci d'avance pour votre aide
By: Skrol29
Date: 2008-09-12
Time: 23:43

Re: Affichage par page

Mais que te retourne la requête avec la clause WHERE ?

Je vois aussi que tu récupère le $RecCnt de l'affichage précédent. Si la requête a elle aussi changée, il faut ré-initilaiser le $RecCnt.