As it stands, your code is difficult to read. You need to indent it properly, e.g.,
foreach ($testArray as $key1 => $value1)
{
if ($value1['node_inx'] == $catID)
{
if (!empty($value1['up3_inx']))
{
echo '<li><a href="dbtest2.php?id='. $value1['up3_inx'] . '&par='. $value1['up3_parent'] .
'&cat=' . $value1['up3_name'] . '">' . $value1['up3_name'] . '</a></li>';
}
if (!empty($value1['up2_inx']))
{
echo '<li><a href="dbtest2.php?id='. $value1['up2_inx'] . '&par='. $value1['up2_parent'] .
'&cat=' . $value1['up2_name'] . '">' . $value1['up2_name'] . '</a></li>';
}
if (!empty($value1['up1_inx']))
{
echo '<li><a href="dbtest2.php?id='. $value1['up1_inx'] . '&par=' . $value1['up1_parent'] .
'&cat=' . $value1['up1_name'] . '">' . $value1['up1_name'] . '</a></li>';
}
if (!empty($value1['node_inx']))
{
echo '<li><strong><a href="dbtest2.php?id='. $value1['node_inx'] . '&par=' . $value1['node_parent'] .
'&cat=' . $value1['node_name'] . '">' . $value1['node_name'] . '</a></strong></li>';
}
}
}
Anyway, it seems to me that you are trying to list the breadcrumbs for each page (category?), then have the loop figure out which page it is and then echo out the breadcrumbs as a list in HTML. However, you assume up to three levels of breadcrumbs, and then you leave them blank.
I'd say that there are more flexible and easier ways of doing this if you want to hard code large arrays up front. For example, you can have one large array to list out all the pages, i.e., their ids, page names and URLs, e.g.,
$page_directory = [
'1' => ['name' => 'business', 'url' => '/whatever/business'],
'2' => ['name' => 'pets', 'url' => '/whatever/business/pets'],
'3' => ['name' => 'dogs', 'url' => '/whatever/business/pets/dogs']
];
Then you have another large array to hard code the breadcrumbs by id, e.g.,
$breadcrumbs = [
'1' => [],
'2' => ['1'],
'3' => ['1', '2']
];
This way, you just need to loop over $breadcrumbs[$catID]. On each iteration, access the $page_directory element corresponding to the value of the current element of $catID, and hence print the list element in HTML.
Of course, this can get pretty unwieldy if you have many pages, but that's the nature of hard coding things.