//echo $req_select;
    $req = mysql_query($req_select) or die('\\nInvalid query: ' . $req_select . ' ' . mysql_error());
    if (mysql_num_rows($req) > 0) {
        $xml = '<xml>';
        while ($row = mysql_fetch_assoc($req)) {
            $xml .= '<object>';
            foreach ($row as $fieldname => $fieldvalue) {
                if ($fieldname == 'category') {
                    $categ_id = $row['id'];
                    $category_path = getCategoryPath($categ_id, $parent_id = 0) . "/" . getCategoryName($categ_id);
                    $category_path = constant('_COLLECTION_CIM_ID_') . "" . $category_path;
                    $xml .= '<' . $fieldname . '>' . $category_path . '</' . $fieldname . '>';
                } else {
                    $xml .= '<' . $fieldname . '>' . $fieldvalue . '</' . $fieldname . '>';
                }
            }
            $xml .= '</object>';
        }
        if ($order_item_id != "") {
            $xml .= getProductAttributeFormattedList($order_item_id);
        }
        $xml .= '</xml>';
        header('Content-type: text/xml');
        echo $xml;
    } else {
        $xml = "<xml></xml>";
    }
} else {
    echo '\\nInvalid query: No parameter given!';
}
mysql_close();
<?php

include "includes/config.inc.php";
include "includes/function.php";
//Get the query string and complete the SQL query
$product_id = "8";
if (isset($_POST['product_id'])) {
    $product_id = $_POST['product_id'];
} elseif (isset($_POST['group_id'])) {
    $product_id = $_POST['group_id'];
}
if ($product_id != "") {
    $xml = '<xml>';
    $xml .= getProductAttributeFormattedList($product_id);
    $xml .= '</xml>';
    header('Content-type: text/xml');
    echo $xml;
} else {
    echo "<xml></xml>";
}
mysql_close();