Salut thugg, merci mille fois. ça fonctionnnnnnnne!!!!!!!!!!!!!!
Merci pour ton soutien psychologique. Effectivement, la seconde requête était de mise. voici ce que ça donne.
Je ne sais pas si c'est propre mais ça marche.
require('include/connexion_bdd.php');
if (isset($_GET['departement_id'])) {
$req = $bdd->prepare( "SELECT b., d.
FROM base_rando b
INNER JOIN departement d
ON b.departement_id = d.departement_id
WHERE b.departement_id = ? AND date_creation >= CURRENT_DATE ORDER BY date_creation
");
$req->execute([$_GET['departement_id']]);
$datas = $req->fetch();
}
if (isset($_GET['departement_id'])) {
$sql = $bdd->prepare( "SELECT b., d.
FROM base_rando b
INNER JOIN departement d
ON b.departement_id = d.departement_id
WHERE b.departement_id = ? AND date_creation >= CURRENT_DATE ORDER BY date_creation
");
$sql->execute([$_GET['departement_id']]);
}
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Helvetica Neue:300,400,500,700,900&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.1/css/all.css" integrity="sha384-50oBUHEmvpQ+1lW4y57PTFmhCaXp0ML5d60M1M7uH2+nqUivzIebhndOJK28anvf" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Montserrat:200,200i,300,300i,400,400i,500,600,700,800,900&display=swap" rel="stylesheet">
<!-- Bikeride CSS -->
<link rel="stylesheet" href="/monsite/asset/css/style.css">
<!-- Bikeride favicon -->
<link rel="shortcut icon" sizes="32x32" href="/monsite/asset/img/favicon-ConvertImage.ico" type="image/ico">
<title></title>
<base href="/monsite/" />
</head>
<body>
<header>
<?php require('include/nav.php'); ?>
<div class="jumbotron jumbotron-fluid jumbotron-bis">
<div class="container">
<br> <br>
<h1 class="text-light"><?php echo'Randonnées vtt - ' .$datas['dept_nom'] ;?></h1>
</a>
</div>
</div>
</header>
<main class="container">
<div class="col-md-12">
<h3 class="index-h4 text-dark"></h3>
<hr class="bg-warning">
<?php
if($sql->rowCount() > 0)
{
while ($d = $sql->fetch(PDO::FETCH_ASSOC)) {
?>
<div class="card m-1">
<div class="card-header" role="tab">
<div class="icon_box float-left">
<div class="top text-secondary"> <?php echo date('d',strtotime($d['date_creation'])) ;?></div>
<div class="bott text-secondary"> <?php echo date('M',strtotime($d['date_creation'])) ;?></div>
<hr class="bg-warning">
</div>
<style>
.randoh5 {font-size: 17px;}
.randoem {font-size: 13px;}
</style>
<h5 class="mb-0 randoh5">
<?php $rando_url = str_replace(' ', '-', $d['rando']);?>
<?php $ville_url = str_replace(' ', '-', $d['ville']);?>
<?php echo '<a href="evenement.php?id='.$d['id'].'/'.$rando_url.'-à-'.$ville_url.'-'.$d['dept_nom'].'-'.$d['dept_num'].'" title="Description de la randonnée sélectionnée" class="text-dark" target="_blank">'; ?>   <?php echo $d['ville'].' - ' .$d['dept_num']. '</a>';?>
<?php echo '<a href="evenement.php?id='.$d['id'].'/'.$rando_url.'-à-'.$ville_url.'-'.$d['dept_nom'].'-'.$d['dept_num'].'" title="Description de la randonnée sélectionnée" class="float-right text-warning" target="_blank"><i class="fas fa-arrow-circle-right text-warning"></i></a>'; ?>
</h5>
<div class="py-2">
<p class="text-warning">   <?php echo $d['rando'];?><br>   <em class="text-secondary randoem">Randonnée vtt</em></p>
</div>
</div>
</div>
<?php
}
}
else {
?>
<div class="alert bg-light" role="alert">
<?php
echo '<h4 class="alert-heading"><i class="fas fa-exclamation-triangle text-warning"></i> Oups!</h4>
<p>Aucune randonnée disponible pour le moment</p>
<a href="rando_vtt.php" class="text-warning"><button type="button" class="btn btn-outline-dark"><i class="fas fa-arrow-left text-warning"></i> Retour</a>';
}
$sql->closeCursor();
?>
</div>
</div>