Jump to content

Is it possible/a good idea to...


Aureole

Recommended Posts

Ok well basically I want to have Categories...then Forums I'm wondering if it's possible/a good idea to query and have a while() when you're already inside a while() statement...e.g.

 

<?php
$query = "SELECT * FROM `categories`'";
$result = mysql_query($query) or die(mysql_error());

while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
{
    $catname = $row['cat_name'];

    echo('<div class="cattitle">'.$catname.'</div>');
    echo('div class="forums">');

    $query = "SELECT * FROM `forums` WHERE category='{$catname}''";
    $result = mysql_query($query) or die(mysql_error());
    while ($row = mysql_fetch_array($result, MYSQL_ASSOC))
    {
        $forumname = $row['forum_name'];
        $forumid = $row['forum_id'];

        echo('<a href="viewforum.php?id='.$forumid.'">'.$forumname.'</a>');
        // etc......
    }
}
?>

 

That should give you a rough idea of what I'm trying to do...

Link to comment
https://forums.phpfreaks.com/topic/68920-is-it-possiblea-good-idea-to/
Share on other sites

No I'm planning on making something I find making things is the best way to learn rather than reading useless tutorials that have no usage in the real World, I just wanted to know if it was possible before I began. Thanks a lot, I'm going to leave this unsolved for now just in case I bump into any errors as last time I tried it - it didn't work as intended. :P

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.