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
| <?php
$conn = new mysqli('localhost','user','pass','bdd');
$conn->query("SET NAMES utf8");
// Nombre TOTAL de lignes à traiter
$riq = "SELECT COUNT(*) as total_lignes FROM syw7g_ameliv
WHERE ((cp_ville != '') AND (a3 = 'C') AND (url IS NOT NULL) AND !(((code_profession = '60') AND (b5 = 'S'))
OR (code_profession = '86') OR (code_profession = '50') OR (code_profession = '21') OR (code_profession = '28') OR (code_profession = '98')));";
$resultat = $conn->query($riq) or die('Erreur SQL !'. $riq .'' . $conn->error);
$row = $resultat->fetch_assoc();
$nbreTotalLignes = $row['total_lignes'];
$resultat->free();
// PAGINATION
$nbreParPage = 4000;
// nombre de pages à créer
$nbreTotalPages = ceil($nbreTotalLignes/$nbreParPage);
// tableau d'affichage des résultats
?>
<table cellpadding="1" cellspacing="1" border="3" style="font-size:12px;">
<thead>
<tr class="centrer-noir">
<th class="centrer">Praticien</th>
<th class="centrer">Profession</th>
<th class="centrer">Spécialité</th>
<th class="centrer">Adresse</th>
<th class="centrer">Ville</th>
</tr>
</thead>
<tbody>
<?php
$numPage = 1;
while($numPage <= $nbreTotalPages)
{
$sqlLimit = $nbreParPage;
$sqlOffset = ($numPage - 1) * $nbreParPage;
$riq = "SELECT nom, prenom, profession, specialite, cp_ville, num_rue, voie, nom_voie, url FROM syw7g_ameliv
WHERE ((cp_ville != '') AND (a3 = 'C') AND (url IS NOT NULL) AND !(((code_profession = '60') AND (b5 = 'S')) OR (code_profession = '86') OR (code_profession = '50')
OR (code_profession = '21') OR (code_profession = '28') OR (code_profession = '98'))) ORDER BY nom LIMIT " .$sqlLimit. " OFFSET " .$sqlOffset. ";";
$resultat = $conn->query($riq) or die('Erreur SQL !'. $riq .'' . $conn->error);
while( $arr = $resultat->fetch_assoc() )
{
$nom = htmlspecialchars(mb_convert_case($arr['prenom'], MB_CASE_TITLE) . ' ' . mb_convert_case($arr['nom'], MB_CASE_UPPER));
$profession = htmlspecialchars(mb_convert_case($arr['profession']), MB_CASE_TITLE);
$specialite = htmlspecialchars(mb_convert_case($arr['specialite']), MB_CASE_TITLE);
$adresse = htmlspecialchars(mb_convert_case($arr['num_rue']. ' ' .$arr['voie']. ' ' .$arr['url'], MB_CASE_LOWER));
$cp = htmlspecialchars($arr['cp_ville']);
?>
<tr>
<td class="centrer"><?php echo $nom; ?></td>
<td class="centrer"><?php echo $profession; ?></td>
<td class="centrer"><?php echo $specialite; ?></td>
<td class="centrer"><?php echo $adresse; ?></td>
<td class="centrer"><?php echo $cp; ?></td>
</tr>
<?php
}
$numPage++;
$resultat->free();
}
$conn->close();
?>
</tbody>
</table> |
Partager