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
| <?php
$titrepage="Liste des interlocuteurs";
//Connnection à la base de données
include('connect.inc.php');
mysql_open();
$affichage=10; //nombre d'enregistrements à afficher par page
//Détermination du nombre de page disponible
if(isset($_GET['np'])) // Si le numero de page est sélectionné
$num_pages=$_GET['np'];
else//Sinon
{
$select="SELECT COUNT(*) FROM interlocuteur";//Compte le nombre d'enregistrements dans la table client
$resultat=mysql_query($select);//Exécution de la requête
$enregistrement=mysql_fetch_array($resultat, MYSQL_NUM);//récupération du nombre d'enregistrement
$nombrenregistrement=$enregistrement[0];
//Calcul du nombre de page disponible
if($nombrenregistrement > $affichage) //Si plus d'une page
{
$num_pages=ceil($nombrenregistrement/$affichage);//numero de pages
}
else
{
$num_pages=1;
}
}
//Détermination du point de départ dans la base de donnée
if (isset($_GET['s']))
{
$depart=$_GET['s'];
}
else
{
$depart=0;
}
$link1 = "{$_SERVER['PHP_SELF']} ?tri=ncli";
$link2 = "{$_SERVER['PHP_SELF']} ?tri=nint";
//vérifie si l'ordre de tri a été défini
if (isset($_GET['tri']))
{
//Détermine comment seront triés les résultats de la requête.
switch ($_GET['tri'])
{
case 'ncli':
$order_by = 'NomCli ASC';
$link1 = "{$_SERVER['PHP_SELF']}?tri=fnd";
break;
case 'fnd':
$order_by = 'NomCli DESC';
$link1 = "{$_SERVER['PHP_SELF']}?tri=ncli";
break;
case 'nint':
$order_by = 'nom ASC';
$link2 = "{$_SERVER['PHP_SELF']}?tri=fnd";
break;
case 'fnd':
$order_by = 'nom DESC';
$link2 = "{$_SERVER['PHP_SELF']}?tri=nint";
break;
default:
$order_by = 'nom DESC';
break;
}
$tri = $_GET['tri'];
}
else
{
$order_by = 'NomCli ASC';
$tri = 'rdd';
}
$strselect="SELECT civilite, codeinterloc, nom, prenom, fonction, telephone, cellulaire, mail, NomCli FROM client, interlocuteur WHERE client.CodeCli=interlocuteur.CodeCli ORDER BY $order_by LIMIT $depart, $affichage";
$result = @mysql_query($strselect);
echo '<table align="center" cellspacing="0" cellpadding="8" border="0" width="98%" id="rounded-corner" bgcolor="#FFFFFF">
<tr >
<th><b><a href="'.$link1.'">Société</a></b></th>
<th><b><a href="'.$link2.'">Nom & Prénoms</a></b></th>
<th><b>Fonction</b></th>
<th><b>Téléphone</b></th>
<th><b>Cellulaire</b></th>
<th><b>E-mail</b></th>
</tr>';
$bg='#eeeeee';
while($row=mysql_fetch_array($result, MYSQL_ASSOC))
{
$bg=($bg=='#eeeeee'? '#ffffff' : '#eeeeee');
echo '<tr bgcolor="'.$bg.'">
<td align="left">' . $row['NomCli'] . '</td>
<td align="left"><a href="infointerlocuteur.php? id=' . $row['codeinterloc'] .'' . $row['nom'] .' '. $row['prenom'] .'">' . $row['civilite'] .' ' . $row['nom'] .' '. $row['prenom'] .'</a></td>
<td align="left">' . $row['fonction'] . '</td>
<td align="left">' . $row['telephone'] . '</td>
<td align="left">' . $row['cellulaire'] . '</td>
<td align="left">' . $row['mail'] . '</td>
</tr>';
}
echo '</table>';
echo'<font size="5"> Total :<font style="color:red;"><b> '.$nombrenregistrement.'</b></font></font>';
if ($num_pages > 1)
{
echo '<br /><p>';
$pagecourante = ($depart/$affichage) + 1;
if ($pagecourante != 1)
{
echo '<a href="listeinterlocuteur.php?s=' . ($depart - $affichage) . '&np=' . $num_pages . '&tri=' . $tri . '">Précédent</a> ';
}
for ($i = 1; $i <= $num_pages; $i++)
{
if ($i != $pagecourante)
{
echo '<a href="listeinterlocuteur.php?s=' . (($affichage * ($i - 1))) . '&np=' . $num_pages . '&tri=' . $tri . '">' . $i . '</a> ';
}
else
{
echo $i . ' ';
}
}
if ($pagecourante != $num_pages)
{
echo '<a href="listeinterlocuteur.php?s=' . ($depart + $affichage). '&np=' . $num_pages .'&tri='.$tri.'">Suivant</a>';
}
echo '</p>';
}
//mysql_free_result($result);
mysql_close();
?> |
Partager