I'm really sorry if this question has already been asked, or answered, but I can't quite seem to find what I need.
I have every other piece of this built, my only question is surrounding inline comments. I would like to do something similar to what Facebook does where they render x comments with a button to display all y comments.
However, the only two ways I can see of doing this are:
Neither one of these seems like a good solution; however, as they both involve a huge waste of resources.
Does anyone have a potential suggestion for implementing this?
SELECT * FROM comments_table WHERE article_id = {something} LIMIT {no_of_comments_per_page} SORT BY date DESC
This is a very simple yet powerful query for the comments.
Actual code
<?php
$sql = "SELECT * FROM comments_table WHERE article_id = 24 LIMIT 40 SORT BY date DESC";
$data = mysql_query($sql);
$comments = mysql_fetch_assoc($data);
foreach($comments as $comment){
$ct++;
echo "ID: {$ct}";
echo "<br />";
echo "Comment: {$comment["comment"]} by {$comment["user"]}";
echo "Date: {$comment["date"]}";
}
?>