View Single Post
09-23-2011, 04:29 PM
#2
Village Genius is offline Village Genius
Village Genius's Avatar
Status: Geek
Join date: Apr 2006
Location: Denver, CO
Expertise: Software
Software: Chrome, Notepad++
 
Posts: 6,894
iTrader: 18 / 100%
 

Village Genius will become famous soon enough

  Old

I can't think of a pure query way to do this off the top of my head but I'm sure there is one. This probably isn't the "best" way to get the task done but it should work. As long as you are using prepared queries the time impact will be minimal:
PHP Code:
<?
$catID
=$_GET["c"];
$DBLink mysqli_connect("host","user","pass","DB");
$DBLink->prepare("SELECT cat_parent_id,cat_name FROM categories WHERE cat_id=?");
$DBLink->bind_param('i',$catID);
$DBLink->bind_result($catID,$name);
do
{
    
$DBLink->execute();
    
$DBLink->fetch();
    
$breadcrumb[]=$name;
} while(
$catID != "0");
?>