Last (n) comments…
-
Here is some code to display a link to the last (n) commented posts:
<?php $query = “SELECT ID, post_title, comment_author, comment_date FROM $tableposts, $tablecomments WHERE $tableposts.ID=$tablecomments.comment_post_ID ORDER BY $tablecomments.comment_date DESC LIMIT 5”;
$result = mysql_query($query);
while ($data = mysql_fetch_row($result)) {
echo “$data[2]
$data[1]
\n”;
} ?>
If you changed your tables and database in anyway you would obviously need to edit the sql calls accordingly, but other than that this works just fine.
Viewing 12 replies - 1 through 12 (of 12 total)
Viewing 12 replies - 1 through 12 (of 12 total)
- The topic ‘Last (n) comments…’ is closed to new replies.