require("util.php3");
DoTitle("Browse Auctions by Item Type");
$sql = new MySQL_class;
$sql->Create("churchil_demo");
/* If this script wasn't handed a Catagory ID, start with top. */
if ($CatID) {
$CatName = $sql->QueryItem("select Name from CatagoryList where ID = $CatID");
} else {
$CatID = 0;
$CatName = "Top Level Catagories";
}
echo("
$CatName
\n");
/* Now print out the sub-catabgories of this particular catagory */
echo("\n");
$sql->Query("select Catagories.ID, Catagories.Name, CatagoryList.Num from Catagories, CatagoryList where Catagories.HigherCat = $CatID and CatagoryList.ID = Catagories.ID");
for ($i = 0; $i < $sql->rows; $i++) {
$sql->Fetch($i);
$id = $sql->data[0];
$name = $sql->data[1];
$num = $sql->data[2];
echo("- $name");
if ($num > 0) {
echo(" ($num)\n");
} else {
echo("\n");
}
}
echo("
\n");
/* Now print out links to any auctions which are contained within
* this catagory.
*/
$sql->Query("select Auctions.ID, Auctions.Name, Auctions.StartTime from Auction_Catagory_Xref, Auctions where Auction_Catagory_Xref.CatID = $CatID and Auction_Catagory_Xref.AuctID = Auctions.ID order by Auctions.StartTime");
if ($sql->rows > 0) {
echo("
\n");
echo("Auctions of $CatName | \n");
for ($i = 0; $i < $sql->rows; $i++) {
$sql->Fetch($i);
$id = $sql->data[0];
$name = $sql->data[1];
$stime = date("Y-M-d H:i",MkUnixTime($sql->data[2]));
echo("$name | \n");
echo(" $stime |
\n");
}
echo("
\n");
}
include("footer.php3");
?>