Comment afficher des pages successive
Bonjours ,,,,
Comme le titre l'indique, je suis debutant en progarmmation php, et je me suis bloqué dans un petit soucis.. j'ai un formulaire de donné ,et je voudrai l'afficher page par page , et avoir des lien "precedent" et "suivant"...
j'ai fait le code , mais il m'apparait un erreur fatale que je connais pas son origine (ligne 107)...
SVP , y a t-il une aide , et ça sera trés syhnpa de sa coté..
voici mon 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
|
<?php
session_start();
//require("afficher.php");
include("connexion.php");
include("message1.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">
<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">
</td>
<td width="87"><a class="linx" href="deco.php">Dé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°</th>
<th width="90"><p align="left" class=text2>N° de série</th>
<th width="107" ><p align="left" class=text2>N°d'immo</th>
<th width="124" ><p align="left" class=text2>N°de Commande</th>
<th width="118" ><p align="left" class=text2>Model</th>
<th width="115" ><p align="left" class=text2>Date de ré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éné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
$limit=50;
$page = isset($_GET['page']) ? $_GET['page'] : '';
$requete = "SELECT * from pc";
$ret = mysql_query($requete);
if($debut==""){$debut=0;}
$debut=$page*$limit;
$nb_total=mysql_num_rows($ret);
$limite=mysql_query("$requete limit $debut,$limit");
$limit_str = "LIMIT ". $page * $limit .",$limit";
$result = mysql_query("SELECT * FROM $basename ORDER BY id ASC $limit_str");
while ($row =mysql_fetch_array ($result) )
{
echo "<tr>";
echo "<td valign=top><p class=text2>$i</td>";
echo "<td valign=top><p class=text2>$row[1]</td>";
echo "<td valign=top><p class=text2>$row[2]</td>";
echo "<td valign=top><p class=text2>$row[11]</td>";
echo "<td valign=top><p class=text2>$row[12]</td>";
echo "<td valign=top><p class=text2>$row[9]</td>";
echo "<td valign=top><p class=text2>$row[7]</td>";
echo "<td valign=top><p class=text2>$row[8]</td>";
echo "<td><p class=text2><img src=img/arrow1.gif border=0> Nom :$row[3]<br>
<img src=img/arrow1.gif border=0> Prénom :$row[4]<br>
<img src=img/arrow1.gif border=0> matricule :$row[5] <br>
<img src=img/arrow1.gif border=0> Service/UF :$row[6]<br>
<img src=img/arrow1.gif border=0> Date d'affectation :$row[10]
</td>";
if ($page>0) {
$precedent=$page-1;
echo "<a href="$PHP_SELF?$page=$precedent"><b>< Page précédente</b></a> ";
}
$i=0;
$j=1;
if($nb_total>$limit) {
while($i<($nb_total/$limit)) {
if($i!=$page){echo " <a href="$PHP_SELF?page=$i">$j</a> ";}
else { echo " <b>$j</b> ";}
$i++;$j++;
}
}
if($debut+$limit<$nb_total) {
$suivant=$page+1;
echo "<a href="$PHP_SELF?page=$suivant"><b>Page suivante></b></a>";
echo"</center>";
}
?>
// initialisation des variable suivant et précédent
<?php
if ($row[8]!="Rebut"){
if ($row[7]!="Affecté"){
echo "<td valign=top><p class=text2>
<a class=linx href=histo.php?id=$row[0]>Historique</a><br>
<a class=linx href=affect.php?id=$row[0]>Affecter</a><br>
<a class=linx href=update.php?id=$row[0]>Signaler Libre</a><br>
<a class=linx href=delet.php?id=$row[0]>Supprimer</a><br>
</td>";
}
else{
echo "<td valign=top><p class=text2>
<a class=linx href=histo.php?id=$row[0]>Historique</a><br>
<a class=linx href=update.php?id=$row[0]>Signaler Libre</a><br>
<a class=linx href=delet.php?id=$row[0]>Supprimer</a><br>
</td>";
}
}
else{
echo "<td valign=top><p class=text2>
<a class=linx href=histo.php?id=$row[0]>Historique</a><br>
<a class=linx href=update.php?id=$row[0]>Signaler Libre</a><br>
<a class=linx href=delet.php?id=$row[0]>Supprimer</a><br>
</td>";
}
echo "<td valign=top><p class=text2>
<a class=linx href=update3.php?id=$row[0]>Signaler fonctionnel</a><br>
<a class=linx href=updat4.php?id=$row[0]>Signaler en reparation</a><br>
<a class=linx href=update2.php?id=$row[0]>Signaler rebut</a><br>
<a class=linx href=raffect.php?id=$row[0]>Réafecter</a><br>
</td>";
echo "</tr>";
$i++;
}
?>
</table>
</td>
</tr>
</table>
</body>
</html> |