function NbImgsIsActive($imgs) { if (isset($imgs)) { $imgsActive = 0; foreach ($imgs as $img) { if (ImgIsActive($img['active'])) { $imgsActive++; } } return $imgsActive; } return ERROR; }
require_once 'header.php'; $req_img = $bdd->prepare('SELECT login FROM users'); $req_img->execute(); $req_img->setFetchMode(PDO::FETCH_ASSOC); $users = $req_img->fetchAll(); $req_img_info = $bdd->prepare('SELECT * FROM imgs'); $req_img_info->execute(); $req_img_info->setFetchMode(PDO::FETCH_ASSOC); $imgs = $req_img_info->fetchAll(); ?> <article class="galerie_div_scroll"> <!-- GALERIE --> <?php foreach ($imgs as $img) { if (ImgIsActive($img['active'])) { // Si les images sont actives $proprio_img = WhoIsTheProprioImg($img, $bdd); ?> <div class="galerie"> <!-- DIV POUR LA PHOTO LES LIKE LES COMS... --> <div class="image_galerie"> <!-- DIV POUR LA PHOTO --> <p class="text_image_galerie" >Photo publiƩ par : <?php echo $proprio_img; ?> .</p> <img class="pic-galerie" src="../img/galerie/<?php echo $img['name']; ?> "/> </div>