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

PHP & Base de données Discussion :

affichage page par page


Sujet :

PHP & Base de données

  1. #1
    Nouveau membre du Club
    Homme Profil pro
    Étudiant
    Inscrit en
    Avril 2011
    Messages
    65
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Tunisie

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Opérateur de télécommunications

    Informations forums :
    Inscription : Avril 2011
    Messages : 65
    Points : 26
    Points
    26
    Par défaut affichage page par page
    bonjours,

    je tient de poser la question à nouveau, puisque je n'ai pas arriver à le faire précedament.En faite ,j'ai un formulaire et je voudrai l'afficher page par page
    j'ai fait le code,, il s'affiche seulement la premiere page. et pourtant il n'a ya d'erreur.
    je sais que le probleme est dans la variable $ limit mais je ne savais le corriger correctement
    SVP qui peut m'aider à faire ça ,et ça sera tré synpa de sa coté
    voici 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
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
     
    <?php
    session_start();
    //require("afficher.php");
    include("connexion.php");
    connect($host,$user,$mot_passe,$db_name);
    if ( !session_is_registered("authen_user")){
    #echo '<META HTTP-EQUIV="refresh" CONTENT="0;URL=index.php?erreur=404">';
    #redirection instantanée
    header("location:index.php?erreur=404");
    }
    //$id=$POST['id'];
    //$sql="select nom from pc WHERE n_serie ='8TMLM4J';
    //mysql_query("$sql");
    //WHILE($tab=mysql_fetch_array($rs)){
    	// echo $tab[nom];}
    //$sql = mysql_query("SELECT Id FROM utilisateurs Where Identifiant ='".$user."' AND Pwd ='".$mot_passe."'") ;
     //$result=mysql_num_rows($sql);
     //$_SESSION['Id']=$result['Id'];
     //$row = mysql_fetch_assoc($sql);
     //$_SESSION['Id'] = $row['Id'];
    	if (isset($_SESSION['login_successful'])){
     echo "<p align=center><b><font face=Arial size=5 color=red>Bonjours </font></b></p>";
     }
    ?>
     
     <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <link href="css/style.css" rel="stylesheet">
    <title></title>
    </head>
    <body topmargin="0" leftmargin="0">
    &nbsp;
    <table width="1265" height="902"  border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#111111" bgcolor="#FFFFFF" style="border-collapse: collapse">
    <tr>
        <td width="100%" height="126" align="left" valign="top">
    <table WIDTH="1265" BORDER="0" CELLPADDING="0" CELLSPACING="0">
                <tr>
                    <td COLSPAN="6"><img SRC="img/header.jpg" WIDTH="387" HEIGHT="94"> </td>
               </tr>
    	       <tr>
                 <td width="89"><a class="linx" href="user_home.php">Consultation  </a></td>
                    <td width="111"><a class="linx" href="new.php">Ajouter nouveau</a></td>
                    <td width="80"><a class="linx" href="find.php">Recherche</a></td>
    			 <td width="100"><a class="linx" href="excel.php">Exportation Excel</a></td>
                   <td width="175">&nbsp;
    			   </td>
                   <td width="87"><a class="linx" href="deco.php">D&eacute;connecxion</a></td>
              </tr>
    		  <tr>
    		    <td COLSPAN="6">
     
    </td>
    	    </tr>
          </table>    </td>
    </tr>
    <tr>
         <td  valign="top"><hr>
    	 <table width="1265"  BORDER="1" bordercolor="#BDE7F7" CELLPADDING="0" CELLSPACING="0">
    	   <tr>
    	     <th width="39"><p align="left" class=text2>N&deg;</th>
    		 <th width="90"><p align="left" class=text2>N&deg; de s&eacute;rie</th>
    		 <th width="107" ><p align="left" class=text2>N&deg;d'immo</th>
    		 <th width="124" ><p align="left" class=text2>N&deg;de Commande</th>
    		 <th width="118" ><p align="left" class=text2>Model</th>
    		 <th width="115" ><p align="left" class=text2>Date de  r&eacute;ception</th>
    		 <th width="105"><p align="left" class=text2>statut affectation</th>
    		 <th width="82"><p align="left" class=text2>statut Pc</th>
    		 <th width="195"><p align="left" class=text2><strong>b&eacute;n&eacute;ficiaire</strong></th>
    		 <th width="105"><p align="left" class=text2>Modifier  statut Affectation</th>
    		 <th width="161"><p align="left" class=text2>Modifier  statut pc</th>
     
    	   </tr>
    	   <?php
    	   //$a=50;
    	   $sql="select * from pc ORDER BY id ASC LIMIT 50";
    	   $rs=mysql_query("$sql");
    	   $total = mysql_num_rows($rs);
    	   $i=1;
    	   while($tab=mysql_fetch_array($rs))
    	   { 
     
     
    	     echo "<tr>";
    		 echo "<td valign=top><p class=text2>$i</td>";
    	     echo "<td valign=top><p class=text2>$tab[1]</td>";
    		 echo "<td valign=top><p class=text2>$tab[2]</td>";
    		 echo "<td valign=top><p class=text2>$tab[11]</td>";
    		 echo "<td valign=top><p class=text2>$tab[12]</td>";
    		 echo "<td valign=top><p class=text2>$tab[9]</td>";
    		 echo "<td valign=top><p class=text2>$tab[7]</td>";
    		 echo "<td valign=top><p class=text2>$tab[8]</td>";
    		 echo "<td><p class=text2><img src=img/arrow1.gif border=0> Nom :$tab[3]<br>
    		 <img src=img/arrow1.gif border=0> Pr&eacute;nom :$tab[4]<br> 
    		 <img src=img/arrow1.gif border=0> matricule :$tab[5] <br> 
    		 <img src=img/arrow1.gif border=0> Service/UF :$tab[6]<br>
    		 <img src=img/arrow1.gif border=0> Date d'affectation :$tab[10]
    		 </td>";
    		 $nombre = 50;  // on va afficher 50 résultats par page.
     
    		 $page = isset($_GET['page']) ? $_GET['page'] : ''; 
             if (!isset($limite)){
    		 $limite = 0; 
    		 $path_parts = pathinfo($_SERVER['PHP_SELF']);
    		  $limitesuivante = $limite + $nombre;
             $limiteprecedente = $limite - $nombre;
            //$page = $path_parts['pc'];
             }
    		 if($limite != 0) {
           ?>
           <form action="'.$page.'" method="post">
          <input type="submit" value="précédents">
          <input type="hidden"  value="'. $limiteprecedente.'"name="limite">
           </form>
    	   <?php
          }
    	  if($limitesuivante < $total) {
    	  ?>
     
        <form action="'.$page.'" method="post">
        <input type="submit"  value="="suivants"/>
        <input type="hidden" value="'. $limitesuivante.'"  name="limite" >
        </form> 
     
     <?php	
       }
    		 // initialisation des variable suivant et précédent
     
    		 if ($tab[8]!="Rebut"){
    		 if ($tab[7]!="Affecté"){
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=affect.php?id=$tab[0]>Affecter</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    		}
    		 else{
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    	    }
    		 }
    		 else{
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=histo.php?id=$tab[0]>Historique</a><br>
    		 <a class=linx href=update.php?id=$tab[0]>Signaler Libre</a><br>
    		 <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    		 </td>";
    	    }
     
    		 echo "<td valign=top><p class=text2>
    		 <a class=linx href=update3.php?id=$tab[0]>Signaler fonctionnel</a><br>
    		 <a class=linx href=updat4.php?id=$tab[0]>Signaler en reparation</a><br>
    		 <a class=linx href=update2.php?id=$tab[0]>Signaler rebut</a><br>
    		 <a class=linx href=raffect.php?id=$tab[0]>Réafecter</a><br>
    		 </td>";
    	     echo "</tr>";
    		 $i++;
    	   }
    	?>
    	<SCRIPT LANGUAGE="Javascript">;
       function confirm() {
     var msg = "Êtes-vous sur de vouloir supprimer ce truc ?";
      if (confirm(msg))
      location.replace(delet.php);
      }
      //<html:submit property="bt_annuler" styleClass="bt_annuler" onclick="javascript:if (!confirm('msg')) return false;"> 
     
    //</html:submit> 
       <a class=linx href=delet.php?id=$tab[0]>Supprimer</a><br>
    	mysql query("DELETE FROM pc WHERE id='$id'");
      <a href="delet.php" onclick="return confirm('Voulez-vous vraiment suprimer cette annonce ?');"></a> 
       </SCRIPT>    
    	 </table>
     
        </td>	   
    </tr>
    </table>
    </body>
    </html>

  2. #2
    Invité
    Invité(e)
    Par défaut
    Ca ne sert à RIEN d'ouvrir plusieurs discussion !!!
    voir : http://www.developpez.net/forums/d11...ire-page-page/

    Et COMMENCE en écrivant un CODE PROPRE !!!
    (indentation, passage a la ligne, ...)

Discussions similaires

  1. Affichage ipconfig /displaydns page par page? windows7
    Par destructive.flame dans le forum Windows
    Réponses: 1
    Dernier message: 28/02/2014, 08h00
  2. [MySQL] Affichage du résultat page par page (pagination)
    Par marcito dans le forum PHP & Base de données
    Réponses: 12
    Dernier message: 20/07/2007, 14h53
  3. [MySQL] Affichage page par page et requêtes du type $sql .=
    Par carelha dans le forum PHP & Base de données
    Réponses: 7
    Dernier message: 06/04/2006, 17h12
  4. [Tableaux] PB liens apres affichage page par page
    Par x2thez dans le forum Langage
    Réponses: 16
    Dernier message: 15/03/2006, 16h58
  5. [MySQL] afficher plusieurs enregistrements par page par page à la volée
    Par pod1978 dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 14/03/2006, 12h22

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