index


SUBMITTED BY: konglong

DATE: Nov. 13, 2016, 12:31 p.m.

FORMAT: PHP

SIZE: 2.5 kB

HITS: 497

  1. <?php
  2. include "include/header.php";
  3. ?>
  4. <!-- Navigation -->
  5. <?php
  6. include "include/navigation.php"
  7. ?>
  8. <!-- Page Content -->
  9. <div class="container">
  10. <div class="row">
  11. <!-- Blog Entries Column -->
  12. <div class="col-md-8">
  13. <?php
  14. $query= "select * from posts";
  15. $select_all_posts=mysqli_query($connection,$query);
  16. while($row = mysqli_fetch_assoc($select_all_posts)){
  17. $post_id=$row['post_id'];
  18. $post_title = $row['post_title'];
  19. $post_author = $row['post_author'];
  20. $post_date = $row['post_date'];
  21. $post_image = $row['post_image'];
  22. $post_content = substr($row['post_content'],0,200);
  23. $post_status=$row['post_status'];
  24. if($post_status !=='Published'){
  25. }else{
  26. ?>
  27. <h1 class="page-header">
  28. Page Heading
  29. <small>Secondary Text</small>
  30. </h1>
  31. <!-- First Blog Post -->
  32. <h2>
  33. <a href="post.php?action=view_post&p_id=<?php echo $post_id; ?>"><?php echo $post_title ?></a>
  34. </h2>
  35. <p class="lead">
  36. by <a href="index.php"><?php echo $post_author ?></a>
  37. </p>
  38. <p><span class="glyphicon glyphicon-time"></span> <?php echo $post_date ?></p>
  39. <hr>
  40. <img class="img-responsive" src="img/<?php echo $post_image ?>" alt="">
  41. <hr>
  42. <p><?php echo $post_content ?></p>
  43. <a class="btn btn-primary" href="post.php?p_id=<?php echo $post_id; ?>">Read More <span class="glyphicon glyphicon-chevron-right"></span></a>
  44. <hr>
  45. <?php } } ?>
  46. </div>
  47. <!-- Blog Sidebar Widgets Column -->
  48. <?php
  49. include "include/sidebar.php"
  50. ?>
  51. <!-- Footer -->
  52. <?php
  53. include "include/footer.php"
  54. ?>

comments powered by Disqus