Category help

PythonPython Forum LeaderThe Royal RAM
I cant find anything on this:

How do I create categories in PHP using a mysql database...For example:

I want to have about 12 top level categories and then I want to have some sub categories beneath each of those....

Are there are tutorials available for creating this?

Thanks

The Royal Ram

Comments

  • martian2k4martian2k4 Llama Hunter Moderator
    hi i will write ou a tutorial or make it for you if you want :D
    Free MySpace Layouts- Coming soon
    Photoshop Tutorials- Coming soon
    Premium PHP Scripts- Coming soon

    Haha i should really do some work so i can remove all the coming soon's
  • PythonPython Forum Leader The Royal RAM
    that would be great..in fact would you mind writing the script but commenting it well so I can figure it out :)

    The Royal Ram

  • martian2k4martian2k4 Llama Hunter Moderator
    ok so you want to be able to add new categories add new links and edit the old ones yes? if this is all it is i will have it done im a few days :D
    Free MySpace Layouts- Coming soon
    Photoshop Tutorials- Coming soon
    Premium PHP Scripts- Coming soon

    Haha i should really do some work so i can remove all the coming soon's
  • ForgeForge Senior Member The Royal RAM
    Umm, Youd need 2 tables. In the second table youd need a field called sub_cat
    and that would contain the ID for the main category.. So...
    [php]

    $query = "SELECT * FROM categorys";
    $result = mysql_query($query);

    while($row = mysql_fetch_assoc($result)){
    $cat_id = $row[cat_id];
    $cat_name = $row[cat_name];
    print "<b>$cat_name<b>:<br>";
    $subs = "SELECT * FROM subcats WHERE sub_cat='$cat_id'";
    $subs = mysql_query($subs);
    while($row = mysql_fetch_assoc($subs)){
    $sub_id = $row[sub_id];
    $sub_name = $row[sub_name];
    print "<a href=\"subcats.php?id=$sub_id\">$sub_name</a><br>";
    }
    }

    [/php]
    Can fat people Go skinny Dipping?
Sign In or Register to comment.