Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & MySQL
PHP & MySQL Forum d'entraide sur les fonctions MySQL avec PHP. Avant de poster -> FAQ MySQL, Cours MySQL et Sources MySQL. Pour les questions concernant le moteur MySQL plutôt que les fonctions PHP, merci d'utiliser le forum MySQL.
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 02/07/2011, 22h57   #1
 
Homme khmaies guesmi
Étudiant
Inscription : avril 2011
Messages : 63
Détails du profil
Informations personnelles :
Nom : Homme khmaies guesmi
Localisation : Tunisie

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

Informations forums :
Inscription : avril 2011
Messages : 63
Points : -3
Points : -3
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 :
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>
pfakhmaies est déconnecté   Envoyer un message privé Réponse avec citation 03
Vieux 03/07/2011, 14h49   #2
Rédacteur
 
Avatar de jreaux62
 
Homme Jérôme Réaux
Webdesigner
Inscription : août 2008
Messages : 2 993
Détails du profil
Informations personnelles :
Nom : Homme Jérôme Réaux
Âge : 45
Localisation : France, Pas de Calais (Nord Pas de Calais)

Informations professionnelles :
Activité : Webdesigner
Secteur : Arts - Culture

Informations forums :
Inscription : août 2008
Messages : 2 993
Points : 5 786
Points : 5 786
Envoyer un message via Skype™ à jreaux62
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, ...)
__________________
"Ce qui se conçoit bien s'énonce clairement - Et les mots pour le dire arrivent aisément."
Nicolas Boileau-Despréaux, Homme de lettres français (1636-1711), principal théoricien de l'esthétique classique.
Site perso Mes tutos DVP : Gestion-Affichage de Nouvelles - Affichage en tableau HTML - Fonctions de redimensionnement d'images
jreaux62 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 06h14.


 
 
 
 
Partenaires

Hébergement Web