SubhanUllah Posted October 24, 2022 Report Share Posted October 24, 2022 <!DOCTYPE html> <html> <head> <!-- CSS --> <link rel="stylesheet" href="https://unpkg.com/flickity@2/dist/flickity.min.css"> <!-- JavaScript --> <script src="https://unpkg.com/flickity@2/dist/flickity.pkgd.min.js"></script> </head> <body> <?php $db = mysqli_connect("localhost", "root", "", "post_images"); $result = mysqli_query($db, "SELECT * FROM posts"); ?> <?php while ($row = mysqli_fetch_array($result)) : ?> <div class="post_container">$row['post_title']; <?php $resultx = mysqli_query($db, "SELECT img_file, img_title FROM images WHERE post_id = " .$row['id_post']); ?> <?php if (mysqli_num_rows($resultx) == 1) : ?> <div class="image_container"> <div class="post_image_displayer"> <?php while ($rowx = mysqli_fetch_array($resultx)) : ?> <img src='../folder_image_uploads/<?php echo $rowx['img_file']; ?>'><?php echo $rowx['img_title']; ?> <?php endwhile; ?> </div> </div> <?php elseif(mysqli_num_rows($resultx) > 1) : ?> <div class="main-carousel" data-flickity='{ "cellAlign": "left", "contain": true }'> <?php while ($rowx = mysqli_fetch_array($resultx)) : ?> <div class="carousel-cell"><img src='../folder_image_uploads/<?php echo $rowx['img_file']; ?>' ></div> <?php endwhile; ?> </div> <?php endif; ?> </div> <?php endwhile; ?> </body> </html> Quote Link to comment Share on other sites More sharing options...
administrator Posted October 24, 2022 Report Share Posted October 24, 2022 At a glance, this code seems right. S 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.