Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3780880
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T10:52:16+00:00 2026-05-19T10:52:16+00:00

I have been developing my own forum for about a week now and I

  • 0

I have been developing my own forum for about a week now and I am almost done with all of the code, however, I am stuck on one single issue that I have not been able to figure out.

Well, simply said I have sub forums that can be within any amount of other sub forums.

How would I create a path dynamically to any of those sub forums on the spot with PHP.

After the path is created I would use it within href’s and other things.

I am guessing I would somehow need to traverse the database based on a ID column and another column that would link one sub forum to another sub forum.

Let’s assume that my database table looks like this:

ID | Name        | Link |
---+-------------+-------
1  | Forum-One   | Top  |
2  | Forum-Two   | 1    |
3  | Forum-Three | 2    |
4  | Forum-Four  | 2    | 
5  | Forum-Five  | 3    |
6  | Forum-Six   | 3    |

How would I go about doing this – or is there something else that must be done instead?

I hope I was clear enough for everyone to understand.

EDIT:

 include("inc/config.php");

 function generateBreadcrumb($startingID){

  $result = mysql_query("SELECT * FROM temp_table WHERE ID='$startingID'");

  while($row = mysql_fetch_array($result))
  {
    $db_id=$row['ID'];
    $db_name=$row['Name'];
  }

     if($db_id!='Top'){
         return generateBreadCrumb($db_id);
     } else {
         return $db_name;
     }
 }

 $startID='6';
 echo generateBreadcrumb($startID);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T10:52:16+00:00Added an answer on May 19, 2026 at 10:52 am

    First you need a terminating condition. So set your top level Forum[link] to null, or ‘top’, or something. Then its simply a matter of using a recursive function put your bread-crumb together.

    So lets assume you wanted to go to display the breadcrumb to Forum-One:Forum-Three:Forum-Six , better known as Forum-Six.

    Example code:

     <?php
     $yourForumId = 6; // replace this dynamically with your forum;
     $breadcrumb = generateBreadcrumb($yourForum);
     function generateBreadcrumb($startingForumId){
         $sql= "SELECT Name ,link FROM Forums WHERE ID = ".$startingForumId;
         //run your $sql however you do to get results
         //assuming you get associative arrays back
         if($res['link'] != 'top'){
             return generateBreadCrumb($res['link']).":".$res['Name'];
         } else {
             return $res['Name'];
         }
     }
     echo $breadcrumb;
     ?>
    

    It’s recursion, which if you’re new to it may seem complicated, but I hope that helps!

    EDIT: here’s your code with the needed edit…

    include("inc/config.php");
    
     function generateBreadcrumb($startingID){
    
         $result = mysql_query("SELECT * FROM temp_table WHERE ID='$startingID'");
    
         $row = mysql_fetch_array($result);
         $db_id=$row['link'];
         $db_name=$row['Name'];
    
         if($db_id!='Top'){
             return generateBreadCrumb($db_id).":".$db_name;
         } else {
             return $db_name;
         }
     }
    
     $startID='6';
     echo generateBreadcrumb($startID);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been developing my own PHP MVC framework. Now I have seen different
I have been developing in Android for approximately two months now. Yesterday, my eclipse
I have been developing the application for drawing, and there is the code: public
I have been developing the application for drawing, and there is the following code
I've been developing in my own django environment for a while now using the
People have been developing own solutions to the following problems: Consistent messaging frameworks for
I have been struggling since I started developing my own modifier functions to get
I have been developing a game in the HTML5/Javascript new canvas feature, and all
App Store We have been developing an app for quite some time now for
I have been developing my own CMS for my own website. Just to test

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.