<?php 
$bdd = new PDO('mysql:host=localhost;dbname=bibliotheque;charset=utf8','root','');
$req = $bdd->prepare('SELECT * FROM articles WHERE idArticle NOT IN (SELECT idArticle FROM articles WHERE Resume IS NULL) ORDER BY idArticle desc');

$req = $bdd->prepare('SELECT * FROM articles join categorie using(idCategorie) WHERE idCategorie = :cat');

$req->execute(array(':cat'=>$_GET['cat']));
?>

<!DOCTYPE html>
<html>
    <head>
        <title>Articles</title>
        <meta charset="utf-8" />
		<link rel="stylesheet" href="bibliotheque.css" />	
    </head>
    <body>

		<div class="fond" id="fond_articles">
	
			<div class="barre_nav" id="barre_nav_articles">
				<ul>
					<div>
						<li>
							<a href="page_accueil.php">Home</a>
						</li>
						<li>
							<a href="a_propos.php">A propos</a>
						</li>
						<li>
							<a href="fiches.php">Fiches</a>
						</li>
						<li>
							<a href="rechercher.php">Rechercher</a>
						</li>
						<li>
							<form method="post" action="barre_recherche.php" class="barre_recherche">
								<input type="text" name="requete" placeholder="votre recherche..." class="barre_recherche_texte" /><input type="submit" value="go" class="go" />
							</form>	
						</li>
					</div>
				</ul>
			</div>	
			
			<div class="sous_fond" id="sous_fond_articles">
				<div class="arborescence">
					<a href="a_propos.php">
						A propos
					</a>
					>
					<span>
						<?php 
							$req2 = $bdd->prepare('SELECT Categorie FROM categorie WHERE idCategorie = ?');
							$req2->execute(array($_GET['cat']));
							foreach($req2->fetchAll() as $ligne){echo $ligne['Categorie'];} 
						?>				
					</span>
				</div>	
				<div class="bloc">			
					<?php 
						foreach($req->fetchAll() as $ligne){ 
					?>
						<div class="home_infos" style="background : url('<?php echo $ligne['Image4'];?>');">
							<div class="cacher" style="background : url('<?php echo $ligne['Image5'];?>');">
								<h2><?php echo $ligne['Titre']; ?> </h2>
								<p>
									<?php echo nl2br($ligne['Resume']); ?>
									<br />
									<a href="article.php?billet=<?php echo $ligne['idArticle']; ?>">voir</a>
								</p>
							</div>
						</div>
					<?php
						}
					?>
				</div>
			</div>
			
	
    </body>
</html>

