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
| $reponse = $bdd->query('SELECT L.TITRE AS titre,
CB.NOM_CONTRIBUTEUR AS contributeurs,
CB.PRENOM_CONTRIBUTEUR AS pre_contributeurs,
CB.ID_CONTRIBUTEUR AS id_contributeurs,
F.NOM_FONCTION AS fonctions,
C.NOM_CATEGORIE AS categories
FROM LIVRE L
INNER JOIN PARTICIPE P ON P.ID_LIVRE = L.ID_LIVRE
INNER JOIN CONTRIBUTEURS CB ON CB.ID_CONTRIBUTEUR = P.ID_CONTRIBUTEUR
INNER JOIN FONCTION F ON F.ID_FONCTION = P.ID_FONCTION
INNER JOIN CLASSIFIE3 A ON A.ID_LIVRE = L.ID_LIVRE
INNER JOIN CATEGORIE C ON A.ID_CATEGORIE = C.ID_CATEGORIE
ORDER BY L.DATE_ACHAT DESC,L.TITRE, F.NOM_FONCTION, CB.NOM_CONTRIBUTEUR
')
or die(print_r($bdd->errorInfo()));
$current['titre'] = "";
$current['fonction'] = "";
foreach($reponse as $row){
$fonctions = $row['fonctions'];
$contributeurs = $row['contributeurs'];
$pre_contributeurs = $row['pre_contributeurs'];
$id_contributeurs = $row['id_contributeurs'];
$categories = $row['categories'];
// détection du passage d'un titre à un autre
if ($row['titre'] != $current['titre']) {
echo '<br/><h3>'.$row['titre'].'</h3><br/>';
$current['titre'] = $row['titre'];
$current['fonction'] = '';
}
// détection du passage d'une fonction à une autre
if ($row['fonctions'] != $current['fonction']) {
echo "<br/>" . $fonctions . '(s) : ';
$current['fonction'] = $row['fonctions'];
}
else {
echo '; ';
}
echo $pre_contributeurs.' ';
echo '<a href="filtres.php?id_contributeur='.$id_contributeurs.'"><strong>'.$row['contributeurs'].'</strong></a>';
echo '<br/>'.$categories;
}
?> |
Partager