Advertisement
Puller

Untitled

May 21st, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. function get_comment_list($conn)
  2. {
  3.     $sql = $conn->prepare("SELECT * FROM comments");
  4.     $sql->execute();
  5.  
  6.     return $sql->get_result();
  7. }
  8.  
  9. $pics= get_comment_list($conn);
  10.  
  11. <?php while ($pic = $pics->fetch_assoc()) : ?>
  12.    <?php include('_comment_list.php'); ?>
  13. <?php endwhile; ?>
  14.  
  15.  
  16. _comment_list.php:
  17.  
  18. <div class="pics">
  19.         <?php if ($pics['images'] != null) : ?>
  20.             <img src="<?php echo asset('images/uploads/' . $pics['images']); ?>" alt="<?php echo $pics['images']; ?>">
  21.         <?php else : ?>
  22.             <img src=<?php echo "https://picsum.photos/300";?> alt="Hiba">
  23.         <?php endif; ?>
  24.     <p class="comment">
  25.         <?php echo $pics['comment']; ?>
  26.     </p>
  27. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement