<?php
function products($categoryID)
{
	echo "<table cellpadding=5 cellspacing=0 border=0 width=100%>";
	$query = "select categoryName from categories where categoryID='$categoryID'";
	$result = mysql_query($query) or die (mysql_error());
	while ($row = mysql_fetch_array($result))
	{
		$categoryName = $row["categoryName"];
	}
	//echo "<tr><td>$categoryName</td></tr>";
	
	$query = "select products.productID, products.productName, products.productPic, products.productDDescrip from products, products_categories where products_categories.categoryID='$categoryID' and products_categories.productID=products.productID order by products.productName";
	$result = mysql_query($query) or die (mysql_error());
	while ($row = mysql_fetch_array($result))
	{
		$productID = $row[0];
		$productName = $row[1];
		$productPic = $row[2];
		$productDDescrip = $row[3];
		echo "<tr><td>";
		echo "<table cellpadding=5 cellspacing=0 border=0 width=100%>";
		echo "<tr><td width=100><img src=\"$productPic\" width=100 height=100></td>";
		echo "<td><a href=\"\" onClick=return(openSmallWindow('productdetail.php?productID=$productID'))>$productName</a></td></tr>";
		/*
		echo "<tr><td colspan=2>$productName</td></tr>";
		echo "<tr>";
		echo "<td valign=top><img src=\"$productPic\"></td>";
		echo "<td>$productDDescrip</td>";
		echo "</tr>";
		*/
		echo "</table>";
		echo "</td></tr>";
		
	}
	echo "</table>";
}
?>