?> ">J'aime</a> <?php } else { ?> <a href="../downvote.php?var=<?php echo $img['id']; ?> ">J'aime plus</a> <?php } ?> <?php if (ImgIsMine($img["id"], $bdd)) { // Si la photo appartient au user logué ?> <a href="../deleteImg.php?var<?php echo $img['id']; ?> ">DEL</a> <?php } ?> </div> <div class="commentaire"> <!-- DIV POUR LES COMMENTAIRES --> <div class="afficheCom"> <?php displayComment($bdd, $img['id']); ?>
function DisplayComment($bdd, $id_img) { $req_comments = $bdd->prepare('SELECT * FROM comments WHERE id_img= :id_img'); $req_comments->bindParam(':id_img', $id_img); $req_comments->execute(); $comments = $req_comments->fetchAll(); if (HaveComment($comments)) { foreach ($comments as $comment) { $user = WhoIS($bdd, $comment['id_user']); if ($comment['active']) { echo $user . " : " . $comment['comment']; } if (ImgIsMine($id_img, $bdd)) { echo '<a href="https://camagru42/delcomment.php?var=' . $comment["id"] . '"> del</a></br>'; } } } else { echo "Soyez le premier a commenter ... :P"; } }