$query = "select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$_SESSION['languages_id'] . "' and c.categories_status != '0' and c.parent_id = '" . $_GET['cPath'] . "' order by c.parent_id, c.sort_order, cd.categories_name"; $data = mysql_query($query); $rows = 0; while ($record = mysql_fetch_array($data) ) { $rows++; $records[] = $record; } $results = ''; $results .= ''; $results .= ''; if (empty($records)) { $results .= ''; } else { foreach ($records as $id=>$row) { $results .= ''; } } $results .= ''; $OUTPUT = $results; $file = 'cache/' . $_GET['cPath'] . '.xml'; $fp = fopen($file,"w"); fputs($fp, $OUTPUT); fclose($fp);