I think I got this script from a SitePoint tutorial. It works fine one one of my websites, but I'm having trouble getting it to work right on another website. It displays the proper breadcrumbs-style navigation links at the top of the page, but the hyperlink URL's are messed up.

This is the script, modified for my new website:

PHP Code:
<?php
$TopnavTable 
'px_topics';
$TopnavName 'URL';

function 
get_path($node$TopnavTable$TopnavName) {
$result mysql_query('SELECT Parent FROM ' $TopnavTable ' WHERE ' $TopnavName '="'.$node.'";');
   
$row mysql_fetch_array($result);
   
$path = array();
   if (
$row['Parent']!='') {
       
$path[] = $row['Parent'];
$path array_merge(get_path($row['Parent'], $TopnavTable$TopnavName), $path);
   }
   return 
$path;
}
$mypath get_path($MyName$TopnavTable$TopnavName);

for(
$i=0;$i<count($mypath);$i++){
echo 
"<a href=\"".str_replace('Arizona'''$mypath[$i])."\"> ".str_replace('_'' '$mypath[$i])."</a>&nbsp;&gt;";
}
?>
And here's a sample from my database table, three rows from the fields URL and Parent:

URL | Parent
People | Topics
Bios | People
Bios/Bill_Gates | Bios

As you can see, Topics is the parent of People, which is the parent of Bios, which is the parent of Bill_Gates. Now if I type the following URL into my browser...

http://ivr/People/Bios/Bill_Gates

...it correctly displays this at the top of the page:

People > Bios > Bill Gates

But when I click on the navigation links, People is linked to
http://MySite/People/Bios/People (It should be http://MySite/People), while Bios is linked to http://MySite/People/Bios/Bios. (It should be http://MySite/People/Bios

Can anyone see what I'm doing wrong? Thanks.