PlaGuE
Jan 20th, 2006, 02:32 PM
okay i have this sql statement
$sql = <<<EOS
SELECT f.id as id, f.forum_cat_id as cid, f.forum_name as forum,
f.forum_desc as description,
count(forum_id) as threads, u.username as mod, u.id as uid
FROM FORUM_TABLE f
LEFT JOIN FORUM_TABLE_POSTS p
ON f.id = p.forum_id
AND p.topic_id=0
AND f.id = p.forum_id
LEFT JOIN FORUM_MEMBERS_TABLE u
ON f.forum_moderator = u.id
WHERE f.forum_cat_id = $cat_row[id]
GROUP BY f.id
EOS;
for a forum im making.
Now it CAN do all i want it to do... but i cant seem to figure out how im going to do it so that with the moderators.
i want to do multiple moderators
instead of ONE MODERATOR per forum.
so instead of
Chit-Chat :: Mod: PlaGuE
Its
Chit-Chat :: Mod: PlaGuE Da_Jordan Guy
it seems that that sql quesry statement only picks the first
u.id that equals f.forum_moderator
as my input in the db for moderator of one forum is.
2, 1, 3
i thought maybe
$moderators = explode(", ", $row['mod']);
foreach($moderators as $mods) {
$mod = $mods;
}
would solve the problem. But it only outputs ONE name/id.
i know im doing something wrong...
i think its cuz im only shoting it once.
this is the place where it outputs.
echo"<tr height='40px'>
<td class='forum_bg'><a href='viewforum.php?f=" .$row['id'] . "'>" . $row['forum'] . "</a><br>
<font size='2px'>" . $row['description']."<br></font></td>
<td class='thread_bg'><div align=center>" . $row['threads']."</div></td>
<td class='thread_bg'><div align=center>".$mod."</div></td>
</tr>";
How would i go about making it almost "loop" after the foreach. Or w/e. so that it returns the correct amount of moderators.
Im not used to doing things like this.
$sql = <<<EOS
SELECT f.id as id, f.forum_cat_id as cid, f.forum_name as forum,
f.forum_desc as description,
count(forum_id) as threads, u.username as mod, u.id as uid
FROM FORUM_TABLE f
LEFT JOIN FORUM_TABLE_POSTS p
ON f.id = p.forum_id
AND p.topic_id=0
AND f.id = p.forum_id
LEFT JOIN FORUM_MEMBERS_TABLE u
ON f.forum_moderator = u.id
WHERE f.forum_cat_id = $cat_row[id]
GROUP BY f.id
EOS;
for a forum im making.
Now it CAN do all i want it to do... but i cant seem to figure out how im going to do it so that with the moderators.
i want to do multiple moderators
instead of ONE MODERATOR per forum.
so instead of
Chit-Chat :: Mod: PlaGuE
Its
Chit-Chat :: Mod: PlaGuE Da_Jordan Guy
it seems that that sql quesry statement only picks the first
u.id that equals f.forum_moderator
as my input in the db for moderator of one forum is.
2, 1, 3
i thought maybe
$moderators = explode(", ", $row['mod']);
foreach($moderators as $mods) {
$mod = $mods;
}
would solve the problem. But it only outputs ONE name/id.
i know im doing something wrong...
i think its cuz im only shoting it once.
this is the place where it outputs.
echo"<tr height='40px'>
<td class='forum_bg'><a href='viewforum.php?f=" .$row['id'] . "'>" . $row['forum'] . "</a><br>
<font size='2px'>" . $row['description']."<br></font></td>
<td class='thread_bg'><div align=center>" . $row['threads']."</div></td>
<td class='thread_bg'><div align=center>".$mod."</div></td>
</tr>";
How would i go about making it almost "loop" after the foreach. Or w/e. so that it returns the correct amount of moderators.
Im not used to doing things like this.