function outputThreadsByTopicID($id) {
// Grab the topic ID and name
$query = "SELECT `id`,`name` FROM `topics` WHERE `id`='$id'";
$retQuery = querySelect($query);
if(mysql_num_rows($retQuery) == 0) {
echo "No Topics To Display";
exit();
}
else {
$row1 = mysql_fetch_row($retQuery);
// Begin table and output topic id,name
echo "
|
Threads |
By |
Replies |
Last Active User |
";
// Grab all thread info where topic_group_id=$id
$query2 = "SELECT * FROM `threads` WHERE `topic_group_id`='$id'";
$retQuery2 = querySelect($query2);
if(mysql_num_rows($retQuery2) == 0) {
echo "
";
echo "No Threads For Current Topic ID";
exit();
} else {
$query3 = "SELECT * FROM `posts` WHERE `thread_group_id`='$id'";
// fetch_array all thread info
while(($row = mysql_fetch_array($retQuery2))) {
$retQuery3 = querySelect($query3);
$replies = mysql_num_rows($retQuery3);
$replies = $replies - 1;
echo "
|
|
".$row['by']." |
".$replies." |
|
|
";
}
// End Table
echo "";
if(isset($_SESSION['alive'])) {
if($_SESSION['rank'] < 4) {
echo "
";
outputCreateThreadBox($id);
}
}
}
}
} // End of Function