<?php
require_once('news/db.php');
require_once('news/config.php');
$commentstoshow = 10;
$allcomments = DataAccess::fetch(sprintf("SELECT user, email, message, id FROM %s ORDER BY timestamp LIMIT 0 , %s", NEWS_COMMENTS, $commentstoshow));
foreach($allcomments AS $comment){
echo $comment['message'] . " - " . $comment['user'] . " - " . $comment['email'] . "<br />";
}
?>
<?php
require_once('news/db.php');
require_once('news/config.php');
$commentstoshow = 10;
$allcomments = DataAccess::fetch(
sprintf(
"SELECT %s.title AS articletitle, %s.id AS articleid, user, email, message, %s.id AS commentid FROM %s LEFT JOIN %s ON %s.pid = %s.id ORDER BY %s.timestamp LIMIT 0 , %s",
NEWS_ARTICLES, NEWS_ARTICLES, NEWS_COMMENTS, NEWS_COMMENTS, NEWS_ARTICLES, NEWS_COMMENTS, NEWS_ARTICLES, NEWS_COMMENTS, $commentstoshow
)
);
foreach($allcomments AS $comment){
echo '<a href="?id=' . $comment['articleid'] . '#' . $comment['commentid'] . '">' . $comment['articletitle'] . '</a>';
echo '<ul><li>' . $comment['message'] . '</li></ul>';
}
?>
<?php
require_once('news/db.php');
require_once('news/config.php');
$commentstoshow = 10;
$allcomments = DataAccess::fetch(
sprintf(
"SELECT %s.title AS articletitle, %s.id AS articleid, user, email, message, %s.id AS commentid FROM %s LEFT JOIN %s ON %s.pid = %s.id ORDER BY %
s.timestamp DESC LIMIT 0 , %s",
NEWS_ARTICLES, NEWS_ARTICLES, NEWS_COMMENTS, NEWS_COMMENTS, NEWS_ARTICLES, NEWS_COMMENTS, NEWS_ARTICLES, NEWS_COMMENTS, $commentstoshow
)
);
foreach($allcomments AS $comment){
echo '<a href="?id=' . $comment['articleid'] . '#' . $comment['commentid'] . '">' . $comment['articletitle'] . '</a>';
echo '<ul><li>' . $comment['message'] . '</li></ul>';
}
?>