<?php
include ("txt/header.php");
?> 
<table width="560" border="0" cellspacing="0" cellpadding="0">
<tr> 
<td height="22" class="menu">
<div align="center">
Категории товаров
</div>
</td>
</tr>
<tr> 
<td align="center" valign="top" class="menu"><table width="560" border="0" cellspacing="1" cellpadding="0">
<tr>
<td align="center" valign="top" bgcolor="#FFFFFF"><table width="550" border="0" cellspacing="5" cellpadding="0">
<tr> 
<td>
<?php
if (isset($_GET['category'])) {
$category=$_GET['category'];
}
if (!isset($category) || $category==" ") {
die('Не выбрана категория!');
} 
$category=mysql_escape_string($category);
$query="select name from categories where (first='$category')";
$res=mysql_query($query);
$number_of_rows=mysql_num_rows($res);
if ($number_of_rows<=0) {
die ('Такой категории не существует!');
}
$row=mysql_fetch_assoc($res);
$name_of_category=$row["name"];
$name_of_category=stripslashes($name_of_category);
echo "<center><font size=2 face='Verdana'><b>$name_of_category</font></center><br>";
echo "<font size=2 face='Courier New'>Подкатегории: ";
$query="select * from subcategories where (parent='$category')";
$result=mysql_query($query);
while ($myrow=mysql_fetch_assoc($result)) {
$name_of_subcategory=$myrow["name"];
$id_of_subcategory=$myrow["first"];
$name_of_subcategory=stripslashes($name_of_subcategory);
echo "<a href='goods.php?subcat=$id_of_subcategory'><u>$name_of_subcategory</u></a> ";
}
?>
</td>
</tr>
</table></td>
</tr>
</table></td></tr></table>
<br>
</td>
</tr>
</table></td>
</tr>
<?php
include ("txt/footer.php");
?> 

