Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.70 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 .= ' COUNT(articleComments.articleId) as `count`';
  7.     $query .= ' FROM articles';
  8.     $query .= ' JOIN articleComments';
  9.     $query .= ' ON articles.id = articleComments.articleId';
  10.     $query .= ' WHERE articles.visible = 1';
  11.     $query .= ' GROUP BY articleComments.articleId DESC LIMIT 6';
  12.    
  13.     $result = mysql_query($query, $dbCon)or die('Unable to read from table. <br/>' . mysql_error() . '<br/>');
  14.  
  15.    
  16. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement