SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Threaded View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Location
    tn
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Repost.. [EDIT: I've Done It!!]

    I posted this the other day, and while someone was kind enough to hang with me for about 12 hours and try to get it to work, it didn't. So I want to try again but hear me out.. the methods that were being sent to me weren't quite the method I figured to be easiest. Although I am the new guy. Please bear with me, getting the forums function is my main goal, as it is the basis of the site. Anyway, here goes: (I apologize in advance for whatever headaches I may cause)

    Ok. I'm trying to make some halfway functional forums. Now, I have the catagories in the database, and pulling from it in my forum.php. What I want, is for the user to click the category name, and it goes to forums2.php and drops down and lists the forums in whatever category they clicked. I assumed it would use this:

    Code:
    <a href="forums2.php?cat_id=<? echo $cat_id ?>
    If you need a visual of what I'm talking about, click here.

    forums.php works fine. I imagine forum2 would just be an altered version of this one, so that when it pulls the category thats sent through the url (with cat_id), it will also list the forums that are associated with it and list them.

    table "categories":

    cat_id......cat_title.......cat_order
    ..1............blah............10

    table "forums"-- sub category

    forum_id......cat_id.....forum_name....forum_order
    ..1..............1.........blah...........10
    .................^This is how the forums associate with parent cat.

    Here is my code for forums.php:
    Code:
    <TABLE WIDTH="100%" border="1" CELLSPACING="0" CELLPADDING="3" bgcolor="#D4D8D6"> 
    <TR ALIGN="left"> 
    <TD WIDTH="2%" CLASS="boardheading" Background="images/top.gif">+ 
    <TD WIDTH="73%" CLASS="boardheading" ALIGN="center" Background="images/top.gif">Category Titles 
    <TD WIDTH="5%" CLASS="boardheading" ALIGN="center" Background="images/top.gif">Topics 
    <TD WIDTH="5%" CLASS="boardheading" ALIGN="center" Background="images/top.gif">Posts 
    <TD WIDTH="15%" CLASS="boardheading" ALIGN="center" Background="images/top.gif">Last post 
    </tr> 
    
    <?php 
    
    require 'db_connect.php'; 
    
    $query="SELECT * FROM categories ORDER BY cat_order ASC"; 
    $result=mysql_query($query); 
    
    $num=mysql_numrows($result); 
    
    mysql_close(); 
    
    if ($num==0) { 
    echo "No Entries."; 
    } else { 
    
    if ($num>25) { 
    $to=25; 
    }else{ 
    $to=$num; 
    } 
    
    } 
    
    $i=0; 
    while ($i < $to) { 
    
    $cat_id=mysql_result($result,$i,"cat_id"); 
    $cat_title=mysql_result($result,$i,"cat_title"); 
    
    ?> 
    
    <TR ALIGN="left"> 
    <TD><a href="forums2.php?cat_id=<? echo $cat_id ?>" style="color:#333333;">+</a><TD><a href="forums2.php?cat_id=<? echo $cat_id ?>" style="color:#333333;"><? echo $cat_title ?></a><TD>10<TD>100<TD>Phases 
    
    <? 
    $i++; 
    } 
    
    echo "<TR ALIGN='left'> 
    <TR> 
    </TABLE>"; 
    
    ?>
    Any ideas?
    Last edited by Phases; Nov 23, 2004 at 03:33.


Bookmarks

Posting Permissions

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