. */ /** * 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"); 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"); OpenTable(); ?>
User Comments
0){ echo "{$comment['author']}"; }else{ echo "Guest"; } ?>
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; $result = $db->Query("SELECT `username`, `avatar` FROM `mybb_users` WHERE `uid` = '$cur_user_id' LIMIT 1"); while(($row = $db->Fetch($result)) != false) { $username = $row['username']; $avatar = $row['avatar']; $logged_in = true; } ?>
Add Your Comment