$val) {
if(in_array($show, array("type", "id", "new", "special"))) {
break;
} else {
$show = false;
}
}
$id = escape_db_input($_GET[$show]);
if ($show == 'type') {
if (isset($_GET['r']))
$r = $_GET['r'];
if (isset($_GET['subtype']))
$subtype = $_GET['subtype'];
if (isset($_GET['country']))
$country = $_GET['country'];
if (isset($_GET['region']))
$region = $_GET['region'];
}
}
if (isset($_GET['r']))
$r = $_GET['r'];
if ($show) {
$query = "SELECT * FROM products WHERE ";
// $product = mysql_fetch_assoc(mysql_query($query));
if ($show == 'id')
$query .= "id = $id";
elseif ($show == 'new')
$query .= "display = 'yes' ORDER BY addedWhen DESC";
elseif ($show == 'special')
$query .= "display = 'yes' AND special = 'yes' ORDER BY RAND()";
else
$query .= "display = 'yes' AND type = '$id'".($subtype ? " AND subtype = '$subtype'" : "").($country ? " AND country = (SELECT id AS country FROM products_countries WHERE name = '$country')" : "").($region ? " AND region = '$region'" : "")." ORDER BY producer,name,country,region";
$results = mysql_num_rows(mysql_query($query)); // total number of items found
if ($show && ($show != 'id'))
$query .= "\n LIMIT $r,$results_per_page";
$result = mysql_query($query);
$fields = mysql_num_fields($result);
echo " \n There were no results in that category; please try again.\n
\n\n";
echo " \n\n";
echo " \n";
include ('Templates/footer.php');
die();
}
elseif ($results == 1 && $show != 'special') {
$product = mysql_fetch_assoc($result);
echo fromDB($product['producer'])." - ".fromDB($product['name']);
}
elseif ($show == "type") {
echo ucfirst($id);
if ($id != 'liquor'){
if ($country || $region)
echo " from ".ucfirst($region ? $region : $country);
}
elseif ($subtype)
echo " - $subtype";
}
elseif ($show == "special")
echo "Our Current Specials";
else
echo ($show == "new" ? "New " : "")."Products";
echo "\n
\n";
if ($show == 'special' && $results)
echo "
|
".fromDB($product['producer'])." - ".fromDB($product['name'])."";
if ($product['type'] != "liquor" && !$region && !$country)
echo " (".(getCountry($product['country']) == 'USA' ? $product['region'] : ($product['region'] ? $product['region'].", " : "").getCountry($product['country'])).")";
echo " ";
echo ($product['stock_clarksville'] != 'out-of-stock' ? drawCheck() : drawX()).' Clarksville'.($product['stock_clarksville']=='limited' ? drawLimited() : '').' ';
echo ($product['stock_newalbany'] != 'out-of-stock' ? drawCheck() : drawX()).' New Albany'.($product['stock_newalbany']=='limited' ? drawLimited() : '');
echo " ";
// echo "\n";
// if ($product['comment'] || $product['copy'])
// echo "\n \n".($product['comment'] ? $product['comment'] : trail($product['copy'],100))."\n"; ?> |