All pastes #163781 Raw Edit

Dr4g

public php v1 · immutable
·published 2006-09-07 21:49 UTC
rendered paste body
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 "			<table width=617 border=0><tr>				<td colspan=3><h3><a href=forum.php?mode=viewtopic&tid="					.$row1[0].">".$row1[1]."</a></h3><br/></td>			  </tr><tr>		    <th width=317 scope=col><div align=left>Threads</div></th>		    <th width=116 scope=col><div align=left>By</div></th>		    <th width=116 scope=col><div align=left>Replies</div></th>					    <th width=154 scope=col><div align=left>Last Active User</div></th>		  </tr>		";				// 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 "</table>";			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 "				  <tr>					    <td valign=top height=15><div align=left>							<a href=forum.php?mode=viewthread&tid=".$row['thread_id'].">".$row['name']."</a><br/>							".$row['desc']."</div>						</td>					    <td valign=top><div align=left>".$row['by']."</div></td>						<td valign=top><div align=left>".$replies."</div></td>											    <td valign=top><div align=left>						<a href=user-profile.php?id=".$row['last_active_user_id'].">"							.grabUserFromID($row['last_active_user_id'])."</a></div>					</td>				  </tr><tr><Td><Br/></td></tr>				";			}			// End Table			echo "</table>";			if(isset($_SESSION['alive'])) {				if($_SESSION['rank'] < 4) {					echo "<br/><Br/>";								outputCreateThreadBox($id);				}			}		}	}} // End of Function