Ok this is the start of my sites forum system. But it only prints out one record and i cant get the two counters to work i cant it to display the post count and the reply count. 😕
_Database______
forum-catagory
id
catagory
forum-topics
id
catagory_id
title
about
forum-posts
id
topic_id
username
date
subject
post
forum-reply
id
posts_id
username
date
subject
post
................................
Forum..............................Topics.......Posts
About
..........Topic 1.....................1...............4...
decript
..........Topic 2.....................1...............4...
decript
..........Topic 3.....................1...............4...
decript
This and that
..........Topic 1.....................1...............4...
decript
..........Topic 2.....................1...............4...
decript
..........Topic 3.....................1...............4...
decript
................................
<?
include("include/session.php");
$sql = "SELECT s.`id`, s.`catagory`, c.`title`, c.`about` FROM `forum-catagory` AS `s` LEFT JOIN `forum-topics` AS `c` ON s.`id` = c.`id` COUNT(d.`topic_id`) AS `ct` FROM `forum-posts` e LEFT JOIN `forum-topics` e ON e.`id`= d.`topic_id`";
$result = mysql_query($sql) or die("Query failed($sql): " . mysql_error());
if(mysql_num_rows($result))
{
print '<table width="100%" border="0" cellpadding="4" cellspacing="1" >';
print '<tr><td width="70%">Forum</td><td width="15%">Topics</td><td width="15%">Posts</td></tr>';
while($row = mysql_fetch_array($result)) {
//the output//
printf("<tr><tr><td><font size=\"+2\" color=\"#ee103a\">%s" . "</font><td></tr>", $row["catagory"]);
printf("<tr><tr><td>%s" . "</td>", $row["title"]);
printf("<td>1</td><td>1</td></tr>");
printf("<tr><tr><td>%s" . "</td></tr></tr>", $row["about"]);
}
print '</tr></table>';
}
?>