Advertisement
Guest User

Untitled

a guest
Dec 8th, 2011
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.31 KB | None | 0 0
  1. <?php
  2.                
  3.         try {
  4.             $dbh = new PDO("mysql:host=$hostname;dbname=tag_website", $username, $password);
  5.         }
  6.         catch(PDOException $e) {
  7.             $e->getMessage();
  8.         }
  9.        
  10.         $sql = "SELECT * FROM blogs";
  11.         foreach ($dbh->query($sql) as $row) {
  12.             $author = $row['author'];
  13.             $title = $row['title'];
  14.             $date = $row['date'];
  15.             $body = $row['body']; ?>
  16.            
  17.             <div id="main" class="blog">
  18.                 <div class="inner-wrap clearfix">
  19.            
  20.                     <div class="content content-left">
  21.                
  22.                         <article class="post post-blog clearfix">
  23.                             <h3 class="post-title"><a href="blog-single.html"><? $title ?></a></h3>
  24.                             <a href="blog-single.html" class="post-image">
  25.                                 <img src="assets/placeholder-615x140.png" width="615" height="140" alt="Post Image" />
  26.                             </a>
  27.                             <div class="post-meta">
  28.                                 <span class="date"><? $date ?></span>
  29.                                 <a class="comment-count" href="blog-single.html#comment-list">2</a>
  30.                                 <ul class="categories-list">
  31.                                 <!-- AUTHOR HERE -->    <li><a href="#"><? $author ?></a></li>
  32.                                 <!-- SUBJECT HERE CONSIDER DELETION --> <li><a href="#">News</a></li>
  33.                                 </ul>
  34.                             </div><!-- end .post-meta -->
  35.                             <div class="post-content">
  36.                                 <? $body ?>
  37.                             </div><!-- end .post-content -->
  38.                         </article><!-- end .post -->
  39.            
  40.                     <hr />
  41.            
  42.         <?php } ?>
  43.  
  44.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement