Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.65 KB | None | 0 0
  1. <?php
  2.  
  3.     $query = 'SELECT DATE_FORMAT(articles.posted, \'%Y%b%d\') as `date`,';
  4.     $query .= ' DATE_FORMAT(articles.posted, \'%l:%i %p\') as `time`, articles.id,';
  5.     $query .= ' articles.title, SUBSTRING(articles.content, 1, 220) as `content`, articles.categoryId,';
  6.     $query .= ' articleComments.articleId';
  7.     $query .= ' FROM articles, articleComments';
  8.     $query .= ' WHERE articles.visible = 1';
  9.     $query .= ' AND articles.id = articleComments.articleId';
  10.     $query .= ' ORDER BY id DESC LIMIT 6';
  11.    
  12.     $result = mysql_query($query, $dbCon)or die('Unable to read from table. <br/>' . mysql_error() . '<br/>');
  13.  
  14. ?>
  15.  
  16. <?php while($row = mysql_fetch_assoc($result))   {   ?>
  17.     <div id="latshad" class="latest corners shadow">
  18.         <a href="article.php?cat=<?php echo $row['categoryId']; ?>&id=<?php echo $row['id'];   ?>">
  19.             <div class="inner corners">
  20.                 <div class="pic corners">
  21.                     <img src="avatars/<?php echo rand(1,3); ?>.jpg">
  22.                     <div class="topGlare">
  23.                     </div>
  24.                     <div class="botGlare">
  25.                     </div>
  26.                 </div>
  27.                 <div class="data corners">
  28.                     <h2><?php echo $row['title'];   ?></h2>
  29.                     <h4><?php echo $row['date'];    ?> at <?php echo $row['time'];    ?></h4>
  30.                         <?php echo $row['articleId']; ?>
  31.                     <hr />
  32.                     <p>
  33.                         <?php echo $row['content'];  ?> - ....
  34.                     </p>
  35.                 </div>
  36.             </div>
  37.         </a>
  38.     </div>
  39. <?php   }   ?>
  40. <br class="clear">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement