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 01/07/2011, 22h35   #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 d'un formulaire page par page

Bonjours

SVP , qui peut m'aider,,j'ai un script php dont le quel je voudrais afficher un formulaire page par page (5O enrigistrement par page suivant id)
j'ai fait le code mais rien est fait ,il m'affiche les 200 enrigistrement que j'ai .. pourtant il n'apparait accun erreur...
svp ,qui peut m'aider ou se trouve l'erreur.. et ça sera 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
 
<?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
	   $sql="select * from pc ORDER BY id ASC LIMIT 50";
	   $result = mysql_query($sql) or die ('Erreur : '.mysql_error() );
        $total = mysql_num_rows($result);
	   //$rs=mysql_query("$sql");
	   //$total = mysql_num_rows($rs);
	   $i=1;
	   //while($tab=mysql_fetch_array($rs))
	   if($total)
	   { 
 
	     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>";
		 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++;
		 $nombre = 50;  // on va afficher 50 résultats par page.
		 $nombre = 50;  // on va afficher 50 résultats par page.
    if (!isset($limite)){ $limite = 0; 
 
    $path_parts = pathinfo($_SERVER['PHP_SELF']);
     $page = $path_parts['pc_sagem'];
	 }
	 // initialisation des variable suivant et précédent
	 $limitesuivante = $limite + $nombre;
      $limiteprecedente = $limite - $nombre;
	  // button "précedent"
  //<form action="<?php echo $page; ?>" method="post">
  <?php
    if($limite != 0) {
   <form methode="post" action="<?php echo $page; ?>">
    <input type="submit" name="xxx" value="précédents" />
    <input type="hidden" name="limite"" value="<?php echo $limiteprecedente; ?>"/>
    </form>
	?>
	if($limitesuivante < $total) 
 
  <form methode="post" action="<?php echo $page;?>" >
    <input type="submit" name="yyy" value="="suivants"/>
    <input type="hidden" name="limite" value="<?php echo $limitesuivante; ?>" />
  </form>
  ?>  
}
}
}
?>
    </table>
 
    </td>	   
</tr>
</table>
</body>
</html>
pfakhmaies est déconnecté   Envoyer un message privé Réponse avec citation 01
Vieux 02/07/2011, 11h08   #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
Citation:
Envoyé par pfakhmaies Voir le message
pourtant il n'apparait accun erreur...
Bonjour, je peux t'assurer que ton code est bourré d'erreurs !

- ligne 23 : un echo ... AVANT <html> ??? (il devrait etre dans le <body>)
- ligne 147 : il manque une fermeture ?>
- ...

CONSEIL : évite de mettre du code html dans du code php
(par exemple : )
remplace
Code :
1
2
3
4
5
6
7
8
9
<?php
	if($total)
	{ 
		echo "<tr>";
		echo "<td valign=top><p class=text2>$i</td>";
		echo "<td valign=top><p class=text2>$tab[1]</td>";
		// ...
	}
?>
par :
Code :
1
2
3
4
5
6
7
8
9
10
11
<?php
	if($total)
	{ 
?>
		<tr>
		<td valign="top"><p class="text2"><?php echo $i; ?></td>
		<td valign="top"><p class="text2"><?php echo $tab[1]; ?></td>
		// ...
<?php
	}
?>
__________________
"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
Vieux 02/07/2011, 12h47   #3
 
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
bonjours,,

j'ai essayé avec votre proposition , mais rien a changé , de plus il m'apparait un erreur a ligne 178 .
voici ma modification;
/////////////////////////////////////////////
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
 
<?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
	   $sql="select * from pc ORDER BY id ASC LIMIT 50";
	   $result = mysql_query($sql) or die ('Erreur : '.mysql_error() );
        $total = mysql_num_rows($result);
	   //$rs=mysql_query("$sql");
	   //$total = mysql_num_rows($rs);
	   $i=1;
	   ?>
	   //while($tab=mysql_fetch_array($rs))
	   <?php
	   if($total)
	   { 
	   ?>
 
	      <tr>
		 <td valign="top"><p class=text2><?php echo $i; ?></td>
	     <td valign="top"><p class=text2><?php echo $tab[1]; ?></td>
		 <td valign="top"><p class=text2><?php echo $tab[2]; ?></td>
		 <td valign="top"><p class=text2><?php echo $tab[11]; ?></td>
		<td valign="top"><p class=text2><?php echo $tab[12]; ?></td>
		 <td valign="top"><p class=text2><?php echo $tab[9]; ?></td>
		 <td valign="top"><p class=text2><?php echo $tab[7]; ?></td>
		 <td valign="top"><p class=text2><?php echo $tab[8]; ?></td>
		 <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>";
 
		 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>";
		 <?php
		}
		?>
		 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++;
		 $nombre = 50;  // on va afficher 50 résultats par page.
		 $nombre = 50;  // on va afficher 50 résultats par page.
		 <?php
    if (!isset($limite)){
 
	$limite = 0; 
 
    $path_parts = pathinfo($_SERVER['PHP_SELF']);
     $page = $path_parts['pc_sagem'];
	 // initialisation des variable suivant et précédent
	 $limitesuivante = $limite + $nombre;
      $limiteprecedente = $limite - $nombre;
	  // button "précedent"
  //<form action="<?php echo $page; ?>" method="post">
  ?>
  }
  <?php
    if($limite != 0) {
	?>
   <form methode="post" action="<?php echo $page; ?>"/>
    <input type="submit" name="xxx" value="précédents" />
    <input type="hidden" name="limite"" value="<?php echo $limiteprecedente; ?>"/>
    </form>
	?>
	if($limitesuivante < $total) 
 
  <form methode="post" action="<?php echo $page;?>" >
    <input type="submit" name="yyy" value="="suivants"/>
    <input type="hidden" name="limite" value="<?php echo $limitesuivante; ?>" />
  </form> 
}
}
}
?>
    </table>
 
    </td>	   
</tr>
</table>
</body>
</html>
pfakhmaies est déconnecté   Envoyer un message privé Réponse avec citation 01
Vieux 02/07/2011, 13h18   #4
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
ligne 103 (entre autres)
__________________
"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
Vieux 02/07/2011, 13h33   #5
Membre chevronné
 
Avatar de micetf
 
Homme Fred
Professeur des Ecoles
Inscription : mai 2009
Messages : 503
Détails du profil
Informations personnelles :
Nom : Homme Fred
Localisation : France, Rhône (Rhône Alpes)

Informations professionnelles :
Activité : Professeur des Ecoles
Secteur : Enseignement

Informations forums :
Inscription : mai 2009
Messages : 503
Points : 701
Points : 701
Voire même à partir de la ligne 97, PHP ou HTML ? on ne sait plus où on en est.
micetf 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 06h09.


 
 
 
 
Partenaires

Hébergement Web