Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,471
There are 1641 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     PHP and MySQL :

Lookup in same table with PHP

Thread title: Lookup in same table with PHP
     
    Thread tools Search this thread Display Modes  
Prev Previous Post   Next Post Next
09-23-2011, 12:06 PM
#1
neojiphre is offline neojiphre
Status: I'm new around here
Join date: Sep 2011
Location:
Expertise:
Software:
 
Posts: 7
iTrader: 0 / 0%
 

neojiphre is on a distinguished road

  Old  Lookup in same table with PHP

I want to create a breadcrumb navigation on my pages, but I have very little knowledge of PHP and MySQL. Here is my situation. I have a table of categories, with a row named 'cat_parent_id' that tells ID of the parent category (there are first level AND second level categories). If the category has no parent ID, it's 'cat_parent_id' is set to 0, meaning that it's a first level category.



So, I would like some help on how to code the PHP for my breadcrumb navigation. I have a page named index.php and whenever I navigate to a category page, the URL becomes 'index.php?c=18' (for category with an ID of 18). I want to use this to create an if statement, that checks if category has parent_id of 0 to only display:

Home >> Category_Name

for my breadcrumbs. If the parent_id is greater than 0, then lookup the name of the category with the ID in the database, then append the name of the current category, eg:

Home >> Parent_Category_Name >> Current_Category_Name

Please some help guys

     


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed