like. The only * requirement is that you must retain this notice, without modifications, at * the top of your source code. No warranties or guarantees are expressed or * implied. DO NOT use this code in a production environment without * understanding the limitations and weaknesses pretaining to or caused by the * use of these scripts, directly or indirectly. USE AT YOUR OWN RISK! */ /* * Giuseppe NADDEO ndd1701@libero.it */ /****************************************************************************** * MAIN *****************************************************************************/ include("../application.php"); include($cnfgpath."header.php"); setdefault($id, 0); $qid_c = get_sub_categories($id); $qid_p = get_products($id); $DOC_TITLE = "Shopping Catalog"; include("templates/catalog.php"); include("$CFG->templatedir/footer.php"); /****************************************************************************** * FUNCTIONS *****************************************************************************/ function get_sub_categories($id=0) { /* get the name and description of all the sub-categories under this one */ $qid = db_query("SELECT id, name, description FROM categories WHERE parent_id = $id AND id > 0"); return $qid; } function get_products($category_id=0) { /* get all the products under this category */ $qid = db_query(" SELECT p.id ,p.name ,p.description ,p.price ,p.on_special ,p.image ,pc.category_id FROM products p ,products_categories pc WHERE p.id = pc.product_id AND pc.category_id = $category_id "); return $qid; } ?>