je regarde de nombreux tutos, mais je galère pas mal pour afficher des résultats par par page.
Voici le code que j'ai mis en place, mais à part ma première ligne qui s'affiche correctement, après j'ai tout qui s'affiche, et quelque soit l'ndroit où j'essaie de mettre un "LIMIT" ça marche plus :
<?php
//Information pour la connection à le DB
$host = 'localhost';
$user = 'root';
$pass = '';
$db = 'vol';
//Connection à la BDD
$link = mysql_connect ($host,$user,$pass) or die ('Erreur : '.mysql_error() );
mysql_select_db($db) or die ('Erreur :'.mysql_error());
$nombre = 5; // on va afficher 5 résultats par page.
if (!isset($limite)) $limite = 0; // si on arrive sur la page pour la première fois
// on met limite à 0.
$choix_critere=$_GET['critere'];
$path_parts = pathinfo($_SERVER['PHP_SELF']);
$page = $path_parts['basename'];
$select = 'SELECT DISTINCT critere FROM criteres WHERE criteres.critere="'.$choix_critere.'" LIMIT '.$limite.','.$nombre;
$result = mysql_query($select,$link) or die ('Erreur : '.mysql_error() );
$row = mysql_fetch_row($result);
$total = $row[0];
/*Requete mysql*/
echo "<br/>";
echo '<li class="pays"><img src="images/pt_logo_webcam_01.png" /> Vous regardez des webcam situées en '.$choix_critere.'</li>';
echo "<br/>";
if(isset($_GET["critere"]))
{
$image = mysql_query("SELECT DISTINCT webcam.url as url, webcam.ville as ville, webcam.commentaire as commentaire, criteres.critere as critere, pays.drapeaux FROM webcam LEFT JOIN criteres ON (webcam.id_critere = criteres.id) LEFT JOIN pays ON (webcam.id_pays = pays.id) WHERE criteres.critere='".$_GET['critere']."'")or die(mysql_error());
while ($affichage = mysql_fetch_assoc($image) )
//while ($row = mysql_fetch_row($result) )
{
echo '<div class="img">';
echo $affichage['ville'];
echo ' <img src="drapeaux_pt/'.$affichage['drapeaux'].'" width="16" height="11">';
echo "<br />";
echo '<img src="'.$affichage['url'].'" width="190" height="143">';
echo "<br />";
//echo $affichage['commentaire'];
echo "</div>";
}
echo "<br />";
}
/*Deconnexion de MySQL*/
mysql_close();
?>
Merci de votre aide