function write_comments_of_post($postid, $showcomments, $orderby = "posttime", $descending = false) { validate_post_id($postid); $top_level = get_top_level_children_of_post($postid, $orderby, $descending); if (mysql_num_rows($top_level) > 0) { echo "<ol class=\"toplevel\">\n"; while ($child = mysql_fetch_array($top_level)) { write_comment_thread($child['id'], $showcomments, $orderby, $descending); } echo "</ol>"; return true; } else { return false; } }
function post_has_comments($postid) { $top_level = get_top_level_children_of_post($postid); return mysql_num_rows($top_level) > 0; }