Results 1 to 9 of 9

Thread: [RESOLVED] output explode()/array() problem[For Lack of Better term]

Threaded View

  1. #1

    Thread Starter
    Hyperactive Member PlaGuE's Avatar
    Join Date
    Jun 2005
    Location
    in ur mind.
    Posts
    445

    Resolved [RESOLVED] output explode()/array() problem[For Lack of Better term]

    okay i have this sql statement
    PHP Code:
    $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
    PHP Code:
     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

    PHP Code:
    $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.
    PHP Code:
        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.
    Last edited by PlaGuE; Jan 21st, 2006 at 02:49 AM.
    Without balance, there could only be chaos.
    Without chaos, there could be no balance.
    I live with karma. Eat with destiny. Dream of life without shackles....
    Yet. If life had no consequences, life could not exist, nor could it flourish.


    If at first you dont succeed.You're screwed.

    C++/Java NOOB.

    I aint a professional at PHP, but if i can help i will.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width