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
|
// Récupération des éléments de recherches
$dpt=$_REQUEST['dpt'];
$j=$_REQUEST['j'];
$nb_pages=$_REQUEST['nb_pages'];
$ligne_debut=$_REQUEST['ligne_debut'];
$page=$_REQUEST['page'];
//SELECTION DE LA BASE
mysql_select_db($base,$mysql_id);
//SELECTION DE LA TABLE
$table = '69382_1576WP';
//CONSTRUCTION DE LA CLAUSE 'WHERE'
if ($dpt){ // Si un nom est inscrit dans le formulaire
$where=" WHERE Code_Dpt_N = ".$dpt."";
}
//NOMBRE DE RÉPONSES
$response = mysql_query("SELECT * FROM $table $where ORDER BY Nom");
$n = mysql_num_rows($response);
//CONSTRUCTION DE LA CLAUSE 'LIMIT'
//Nombre d'enregistrements souhaités par page
$nb_par_page=100;
if (!$page){
$ligne_debut=0;
}
else{
$page=$page-1;
$ligne_debut=$page*$nb_par_page;
}
$limit=" LIMIT ".$ligne_debut.",".$nb_par_page;
//REQUETE SQL
$qry="SELECT * FROM $table".$where." ORDER BY Nom " .$limit;
//echo $qry;
//EXECUTION DE LA REQUETE
$result=mysql_query($qry);
//CALCUL DU NOMBRE DE PAGES
if (!$nb_pages) { // Si le nb de pages n'a encore jamais été calculé
if ($dpt){
$nb_fiches_max=mysql_num_rows($result);
}
else{
$qry2="SELECT * FROM $table".$where." ORDER BY Nom " .$limit;
//echo $qry2;
$result2=mysql_query($qry2);
$nb_fiches_max=mysql_num_rows($result2);
}
$nb_pages=($n/$nb_par_page);
$nb_pages=ceil($nb_pages);
}
// ajout TEST
$nb_pages=($n/$nb_par_page);
$nb_pages=ceil($nb_pages);
// MESSAGE AU DESSUS DU TABLEAU
if ($n > 0){ //S'il y a au moins un résultat
$page=$page+1;
$msg= "page ".$page." sur ".$nb_pages; //On affiche le nombre de pages sur le total
}
else{
$msg="Désolé, aucun enregistrement trouvé !"; //Sinon, on signale qu'il n'y a pas de résultats
}
?>
</head>
<body bgcolor="#C2FE81">
<h1 style="text-align: center">Morts Pour la France 1914-1918<br>
Signalés à Lyon</h1>
<h3 align="center">Il y a <font color="red"><?php echo $n ?></font> réponses dans le département <?php echo $dpt ?></h3>
<center>
<?php
echo $msg."\n"; // On écrit le message au dessus du tableau
?>
</center>
<br>
<!-- EN-TÊTES DU TABLEAU -->
<center>
<table class="result">
<tr>
<td class="nom">Nom</td>
<td class="prenom">Prénom</td>
<td class="date_N">Date Naissance</td>
<td class="lieu_N">Lieu Naissance</td>
</tr>
<!-- FIN EN-TÊTES DU TABLEAU -->
<!-- REMPLISSAGE DU TABLEAU -->
<?php
while($row=mysql_fetch_object($result)){
echo "<tr style=\"cursor: hand;\" onmouseover=\"this.style.backgroundColor='#6C81B9'\" onmouseout=\"this.style.backgroundColor = ''\" onclick=\"javascript:window.open('../pop_1576.php?id=$row->Id','photo','width=750,height=580,left=0,top=0,toolbar=no,menubar=no,resizable=no,scrollbars=yes');return(false)\">\n";
echo "<td>$row->Nom</td>\n";
echo "<td>$row->Prenom</td>\n";
echo "<td>$row->Date_N</td>\n";
echo "<td>$row->Lieu_N</td>\n";
echo "</tr>\n";
}
?>
</table>
</center>
<!-- FIN REMPLISSAGE DU TABLEAU -->
</div>
<!-- LIENS VERS LES AUTRES PAGES -->
<div align="center" class="pages">
<?php
$i=0;
while ($i <= $nb_pages-1):
$j=$i+1;
if (!$dpt){
echo "<span class=\"page\"><a href=\"dpt_N.php?page=".$j."&nb_pages=".$nb_pages."\">".$j."</a></span>\n";
}
else if ($dpt) {
echo "<span class=\"page\"><a href=\"dpt_N.php?page=".$j."&nb_pages=".$nb_pages."&dpt=".$dpt."\">".$j."</a></span>\n";
}
else{
echo "<span class=\"page\"><a href=\"dpt_N.php?page=".$j."&nb_pages=".$nb_pages."&dpt=".$dpt."\">".$j."</a></span>\n";
}
$i++;
endwhile;
?>
</div>
<!-- FIN LIENS VERS LES AUTRES PAGES --> |
Partager