<?php
include("include/data.php");
Init_boutique();
global $link, $base, $MySQL_Host, $MySQL_User, $MySQL_Passw, $db, 
$CodeArt, $myart, $NomArticle, $PrixArt, $PrixArtPd, $NumArt, 
$CodeArts, $A_NumArt,$i, $result, $NbLigne, $mygroupeart, 
$mysousgroupeart, $semaine, $limitesuivante, $limiteprecedente, 
$limite, $total, $page ;
// entete de la page

include 'menu/header.php';

$nombre = 10;  // on va afficher 5 résultats par page.
$limite=$_GET['limite'];
if (!isset($limite)) $limite = 0; // si on arrive sur la page pour la première fois 
               // on met limite à 0.
$limitesuivante = $limite + $nombre;
$limiteprecedente = $limite - $nombre;
$selectc = 'SELECT Num_Client FROM clients';
$selectc.=" WHERE IdNumClient='".$IdNumClient."'";
$result = mysqli_query ($link, $selectc);
$row =  mysqli_num_rows($result);
$total = $row;
/*
echo "<br>".$total." | ".$limite." | ".$limitesuivante." | ".$limiteprecedente ."<br>";
*/
echo "<center><b>Liste Adh&#233;rents</b></center>" ;

echo "<center><HR size='1' width='500'>";
echo "<span class='t-text'>";
echo "<table border='1' cellpadding='1' cellspacing='1' width='500' height='22'><tr>";
echo "<td width='30' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Num Clt</div></td></span>";
echo "<td width='20' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Lettre</td></span>";
echo "<td width='120' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Nom Clt</td></span>";
echo "<td width='120' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>Adresse</td></span>";
echo "<td width='32' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>M</td></span>";
echo "<td width='32' height='20' valign='center' bgcolor='#CCCCCC'>
	<div align='center'><span class='t-text'>D</td></span>";
echo "</tr>";

$myart =new clients;
$select = 'select * FROM clients';
$select.=" WHERE `IdNumClient`='".$IdNumClient."'";
$select.=' ORDER BY Num_Client ASC limit '.$limite.','.$nombre;
$result = mysqli_query($link, $select);
$myart->getnum($result);
while ($myart->z < $myart->num) {
  $myart->readrow($result);
  $Num_Client=$myart->Num_Client ;
  $Let_Client=$myart->Let_Client ;
  $Nom_Client=$myart->Nom_Client ;
  $Adr_Client=$myart->Adresse_2 ;
 
  echo "<tr><td width='30' height='20' valign='center'>
	<div align='center'><span class='t-text'><a class='' href='adherent_fiche.php?num_client=$Num_Client'>$Num_Client</a></div></td></span>";
	echo "<td width='20' height='20' valign='center'>
	<div align='center'><span class='t-text'>$Let_Client</div></td></span>";
	echo "<td width='120' height='20' valign='center'>
	<div align='center'><span class='t-text'>$Nom_Client</div></td></span>";
	echo "<td width='120' height='20' valign='center'>
	<div align='center'><span class='t-text'>$Adr_Client</div></td></span>";
	echo "<td width='20' height='20' valign='center'>
	<div align='center'><a class='' href='adherent_fiche.php?num_client=$Num_Client'><img src='images/modifie.png' width='20' height='20'></a></div></td>";
		echo "<td width='20' height='20' valign='center'>
	<div align='center'><img src='images/pblle.jpg' width='20' height='20'></div></td></tr>";
} 
echo "</tr></table>";
echo "<br><br>";
echo "<table border='1' cellpadding='0' cellspacing='0' width='500' height='22'><tr>";
echo "<td width='120' height='20' valign='center'><div align='center'><span class='t-text'>";
	 
if($limite != 0) {
    echo '<a href="'.$page.'?limite='.$limiteprecedente.'">Page precedente</a>';
}
echo "</div></td></span>";
echo "<td width='120' height='20' valign='center'><div align='center'><span class='t-text'>";
if($limitesuivante < $total) {
    echo '<a href="'.$page.'?limite='.$limitesuivante.'">Page Suivante</a>';
}
echo "</div></td></span>";
echo "</tr></table>";


include 'menu/footer.php';
?>