Everything is coming from a PDO and is well displaying with the exception of the image. I wrote the folder's path in the DB as if it was written after a src=
As a beginner in php, i'm wondering if it's the good way to display a picture
EDIT: images are in jpg, console shows a "404" but with the good path
<?php
try {
$bdd = new PDO(/*the pdo works*/);
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
$reponse = $bdd->query('SELECT * FROM equipepedagogique');//where the picture is
?>
<div class="enseignants"><!--grid-->
<!--case-->
<?php
while ($donnees=$reponse->fetch())
foreach ($donnees as $donnee) {
$img=$donnees['photo'];
$nom=$donnees['name'];
$prenom=$donnees['surname'];
$fonction=$donnees['fonction'];?>
<div class="enseignant">
<a href="">
<img src="<?php echo $img?>" alt="" class="photoEnseignant">
</a>
<h1 style="margin-left:auto;margin-right:auto;"><?= $prenom .' '. $nom ?></h1>
<p><?= $fonction ?></p>
</div>
<?php } ?>
</div>
$imgcontain?