Aujourd'hui j'ai un problème je souhaite paginer le nombre d'enregistrements à afficher sur cette page : http://lefebvresbook.monespace.net/infographie.php
J'ai trois tables liées dans cette requête :
- infographisme qui comporte les infos principales sur mes projets de créations
- captures qui comporte les différentes captures de mes créations et qui est liée à la table infographisme par le champ parentcaptureID au champ ID de la table infographisme
- notesinfo qui comporte les notes que les visiteurs donnent à mes création et qui est reliée par le champ IDparentnote au champ ID de la table infographisme
<?php
$pageon = 2;
$pageoff = 1150;
mysql_select_db($database_portfoliodata, $portfoliodata);
if (isset($_POST['trier'])){
if (($_POST['trier'])=='notes-decroissantes'){
$infographinfos = "SELECT Nom_projet, Capture, note, infographisme.ID, Date_projet, Short_description, ROUND(AVG(`note`)) AS Moyenne FROM infographisme LEFT OUTER JOIN notesinfo ON IDparentnote = infographisme.ID LEFT OUTER JOIN captures ON parentcaptureID = infographisme.ID GROUP BY infographisme.ID ORDER BY Moyenne DESC LIMIT $pageon,$pageoff";}
elseif (($_POST['trier'])=='notes-croissantes'){
$infographinfos = "SELECT Nom_projet, Capture, note, infographisme.ID, Date_projet, Short_description, ROUND(AVG(`note`)) AS Moyenne FROM infographisme LEFT OUTER JOIN notesinfo ON IDparentnote = infographisme.ID LEFT OUTER JOIN captures ON parentcaptureID = infographisme.ID GROUP BY infographisme.ID ORDER BY Moyenne LIMIT $pageon,$pageoff";}
elseif (($_POST['trier'])=='noms-A-Z'){
$infographinfos = "SELECT Nom_projet, Capture, note, infographisme.ID, Date_projet, Short_description, ROUND(AVG(`note`)) AS Moyenne FROM infographisme LEFT OUTER JOIN notesinfo ON IDparentnote = infographisme.ID LEFT OUTER JOIN captures ON parentcaptureID = infographisme.ID GROUP BY infographisme.ID ORDER BY Nom_projet LIMIT $pageon,$pageoff";}
elseif (($_POST['trier'])=='noms-Z-A'){
$infographinfos = "SELECT Nom_projet, Capture, note, infographisme.ID, Date_projet, Short_description, ROUND(AVG(`note`)) AS Moyenne FROM infographisme LEFT OUTER JOIN notesinfo ON IDparentnote = infographisme.ID LEFT OUTER JOIN captures ON parentcaptureID = infographisme.ID GROUP BY infographisme.ID ORDER BY Nom_projet DESC LIMIT $pageon,$pageoff";}
elseif (($_POST['trier'])=='plus-anciennes'){
$infographinfos = "SELECT Nom_projet, Capture, note, infographisme.ID, Date_projet, Short_description, ROUND(AVG(`note`)) AS Moyenne FROM infographisme LEFT OUTER JOIN notesinfo ON IDparentnote = infographisme.ID LEFT OUTER JOIN captures ON parentcaptureID = infographisme.ID GROUP BY infographisme.ID ORDER BY Date_projet LIMIT $pageon,$pageoff";}
elseif (($_POST['trier'])=='plus-recentes'){
$infographinfos = "SELECT Nom_projet, Capture, note, infographisme.ID, Date_projet, Short_description, ROUND(AVG(`note`)) AS Moyenne FROM infographisme LEFT OUTER JOIN notesinfo ON IDparentnote = infographisme.ID LEFT OUTER JOIN captures ON parentcaptureID = infographisme.ID GROUP BY infographisme.ID ORDER BY Date_projet DESC LIMIT $pageon,$pageoff";}
}
else {
$infographinfos = "SELECT Nom_projet, Capture, note, infographisme.ID, Date_projet, Short_description, ROUND(AVG(`note`)) AS Moyenne FROM infographisme LEFT OUTER JOIN notesinfo ON IDparentnote = infographisme.ID LEFT OUTER JOIN captures ON parentcaptureID = infographisme.ID GROUP BY infographisme.ID ORDER BY infographisme.ID DESC LIMIT $pageon,$pageoff";}
$req1 = mysql_query($infographinfos) or die('Erreur SQL !<br>'.$infographinfos.'<br>'.mysql_error());
$totalRows_infographinfos = mysql_num_rows($req1);
while ($row_infographinfos = mysql_fetch_assoc($req1))
{
?>[/b][/color]La clause LIMIT n'affiche jamais le nombre d'enregistrements souhaités (tests avec plusieurs nombres sans succès),
Je remercie la communauté de bien vouloir m'aider à solutionner ce problème car l'affichage risque d'être long passé un certain nombre de créations.