Thanks Ajeh, I've updated my code as required:
<!--bof Product description -->
<?php
$current_categories_list = ""; //database filled category list
$sep = ""; //separator between category names
// categories_description
$sql = "SELECT cd.categories_name
FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd, " . TABLE_PRODUCTS_TO_CATEGORIES . " ptoc
WHERE cd.categories_id = ptoc.categories_id
AND ptoc.products_id = " . (int)$_GET['products_id'];
$categories_list_lookup = $db->Execute($sql);
if ($categories_list_lookup->RecordCount() > 0) { //if categories are returned from the SQL
while (!$categories_list_lookup->EOF) { //for each category name append it to a string
$current_categories_list .= $sep . $categories_list_lookup->fields['categories_name'];
$sep = ", "; //the separator between category names is a comma except for the first time round
$categories_list_lookup->MoveNext();
}
}
// use a string replace function to look for %compatibility_list% in the description and replace it with the SQL-driven category list
if ($products_description != '') { ?>
<div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes(str_replace("%compatibility_list%", $current_categories_list, $products_description)); ?></div>
<?php } ?>
<!--eof Product description -->
Upwardtrend, I'm not sure about the categories array but the easiest way I can think of to check what it is is to output the contents of it:
print_r($myarray);
If your online shop is in use at the moment, I suggest you either use a test environment, or try it late at night when nobody will be viewing your wares, or maybe you could try ouputting the array contents with a html around it (<!-- -->) so that it is only viewable in the source code, don't forget to remove it again though.
I suspect that it is an array of sub categories for the category you're currently in (if there are any) or maybe its used for the category menus - but they're just guestimates, maybe Ajeh or someone else has an idea.
Col