How can I display only certain images from my database that have the same ID and not just display all of them?

Viewed 47

enter image description here

This image shows that I assigned different house_ID's for each image. Despite that, I would like to display images that have the same house_id, instead of just displaying all of them. For example, I would like to only display images with the house_id of 4. Does anyone know how to do this?

This is my current code which just displays all of them in a slide show.

<?php
// Include the database configuration file
include_once 'dbConfig.php';
  // Get images from the database
$query = $db->query("SELECT * FROM images2 ORDER BY house_id DESC");
?>


<div class="frame">
            <div class="slideshow-container">
            <?php if($query->num_rows > 0){
              while($row = $query->fetch_assoc()){

                $imageURL = 'uploads2/'.$row["file_name"];?>
                <div class="mySlides fade">
            <img style="height: 200px;" src="<?php echo $imageURL; ?>">
             </div><?php }?>
             
             <a class="prev" onclick="plusSlides(-1)">&#10094;</a>
             <a class="next" onclick="plusSlides(1)">&#10095;</a>
        </div></div>
0 Answers
Related