Bonjour, j'ai éseillé de faire le sistème de pagination http://www.grafikart.fr/tutoriels/pagination-php-51
Mais ca me met: No database selected
Et mon code est:
Ma base de données s'apelle: passiondelair V5Code PHP:
<?php
$pdo_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$bdd = new PDO('mysql:host=localhost;dbname=passiondelair V5', 'root', '', $pdo_options);
$sql = "SELECT COUNT(id) as nbArt FROM articles";
$req = mysql_query($sql) or die(mysql_error());
$data = mysql_fetch_assoc($req);
$nbArt = $data['nbArt'];
$perPage = 1;
$nbPage = ceil($nbArt/$perPage);
if(isset($_GET['p']) && $_GET['p']>0 && $_GET['p']<=$nbPage){
$cPage = $_GET['p'];
}
else{
$cPage =1;
}
$sql = "SELECT * FROM articles ORDER BY id DESC LIMIT ".(($cPage-1)*$perPage).",$perPage";
$req = mysql_query($sql) or die(mysql_error());
while($data=mysql_fetch_assoc($req)){
echo "<h1>(".$data['titre']."}</h1>";
echo $data['texte'];
echo "<hr/>";
}
for($i=1;$i<=$nbPage;$i++){
if($i==$cPage){
echo " $i /";
}
else{
echo " <a href=\"articles.php?p=$i\">$i</a> /";
}
}
?>
La table: articles
et les champs: id, titre, texte, signature
Aidez moi svp![]()
-----