function article($link){
print_story($link->id);
print_comment(0,$link->id);
}
function print_comment($parent_id, $link_id){
$comments = $db->get_col("SELECT comment_id FROM table_comments WHERE comment_link_id=$link_id and comment_parent = $parent_id ORDER BY comment_votes DESC");
if ($comments) {
$comment = new Comment;
foreach($comments as $comment) {
$comment->print();
}
print_comment($comment_id,$link_id);
}
}
}TABLE `table_comments` (
`comment_id`, `comment_parent`, `comment_link_id`, `comment_votes`
)If you store and manipulate all the data in memory, I don't see why this would be that bad?