Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.