Jump to content

Recommended Posts

Posted
<!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> 

 

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...