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
................................
____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
................................
PHP:
<?
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.`catagory_id` GROUP BY s.`id`";
$result = mysql_query($sql) or die("Query failed($sql): " . mysql_error());
print '<table width="100%" border="1" 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)) {
printf("<tr><tr><td><font size=\"+2\" color=\"#ee103a\">%s" . "</font><td><td></td></tr>", $row["catagory"]);
WHILE($row = mysql_fetch_array($result)) {
printf("<tr><tr><td>%s" . "</td>", $row["title"]);
print("<td>1</td><td>1</td></tr>");
printf("<tr><tr><td>%s" . "</td><td></td><td></td></tr></tr>", $row["about"]);
print '</tr>';
}
}
print '</table>';
?>