. */ /** * getNewsComments($id) * Function getting an array of comments for posted news * @param id - news_id cooresponding to `bayonet_news` * @return - associative array of comments */ function getNewsComments($id){ global $db; $result = $db->Query("SELECT c.comment_id, c.news_id, c.author_id, c.message, c.date, u.username AS author, u.avatar as avatar ". "FROM `bayonet_news_comments` AS c ". "LEFT OUTER JOIN `mybb_users` AS u ON u.uid = c.author_id ". "WHERE c.news_id = '$id' ". "ORDER BY date ASC"); $comments = $db->Fetch($result); /* while(($row = $db->Fetch($result)) != false) { $comments[] = $row; } $db->Free($result); */ return $comments; } /** * displayComments($data) * Function that takes an array of comments and displays them in html * @param data - associative array of comments from the database */ function displayComments($data){ date_default_timezone_set("America/New_York"); OpenContent(); ?>
User Comments
0){ echo "{$comment['author']}"; }else{ echo "Guest"; } ?>
"; } foreach($data as $news) { $numComments = getNumOfComments($news['news_id']); OpenContent(); ?>
Continue reading.'; } else { echo bbcode_format($news['message']); } ?>
Comment: {$comment}
"; echo "Your comment has been processed. Please wait.
"; } $cur_user_id = 0; //testing variable, until i get the login system working for this $logged_in = false; ?>
Add Your Comment