include "mysql.inc.php";
$link = mysql_connect("mysql3.ezhostingserver.com", "evildj", "pbhell");
mysql_select_db("myhnt4b054");
if (isset($_GET[id])) {
$max_display = 15;
$start = (empty($_GET[start])) ? 0 : $_GET[start];
$query1 = "SELECT ID FROM products_new WHERE subcat = '$id' OR subcat LIKE '$id,%' OR subcat LIKE '%,$id' OR subcat LIKE '%,$id,%'";
$query2 = "SELECT * FROM products_new WHERE subcat = '$id' OR subcat LIKE '$id,%' OR subcat LIKE '%,$id' OR subcat LIKE '%,$id,%'";
$belt_size = (!empty($_POST[belt_size])) ? $_POST[belt_size] : $_GET[belt_size];
$size_query = " AND sizes LIKE '%" . $belt_size . "%'";
$belt_style = (!empty($_POST[belt_style])) ? $_POST[belt_style] : $_GET[belt_style];
if ($belt_style == 1) {
$style_query = " AND (styles = '1' OR styles LIKE '1,%')";
} else {
$style_query = (!empty($belt_style)) ? " AND styles LIKE '%$belt_style%'" : "";
}
$belt_options = (!empty($_POST[belt_options])) ? $_POST[belt_options] : $_GET[belt_options];
if ($belt_options == 1) {
$option_query = " AND (options = '1' OR options LIKE '1,%')";
} else {
$option_query = (!empty($belt_options)) ? " AND options LIKE '%$belt_options%'" : "";
}
$belt_color = (!empty($_POST[belt_color])) ? $_POST[belt_color] : $_GET[belt_color];
$color_query = (!empty($belt_color)) ? " AND color LIKE '$belt_color%'" : "";
$order_query = " ORDER BY ID DESC";
$limit_query .= " LIMIT $start, $max_display";
$query1 .= $style_query . $option_query . $color_query . $size_query;
$result = mysql_query($query1);
$num_records = mysql_num_rows($result);
if (!$num_records) {
header("Location:custom_belts.php");
exit;
}
if ($num_records > $max_display) {
$z = 1;
for ($x = 0; $x < $num_records; $x += $max_display) {
if ($x == $start) {
$pages .= "
";
} else {
$pages .= "" .
"
";
}
$z++;
}
if ($start + $max_display < $num_records) {
$next = "
";
}
if ($start - $max_display >= 0) {
$prev = "
";
}
$links = $prev . $pages . $next;
}
$query2 .= $style_query . $option_query . $color_query . $size_query . $order_query . $limit_query;
$result = mysql_query($query2);
$rows = mysql_num_rows($result);
if ($rows) {
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$img = "";
if (!empty($line[photo])) {
$img = "
";
$img_arr = explode(",", $line[photo]);
foreach($img_arr as $image) {
$img .= "" .
" " .
" | ";
}
$img .= "
";
}
$listings .= "| " .
"$line[title] |
" .
" " .
htmldecode(nl2br($line[description])) . "
Available Sizes: $line[sizes] |
" .
"" .
"| $img |
";
}
} else {
$listings = "| No Matching Listings - Please Call for Availability |
";
}
}
$query = "SELECT * FROM belt_styles ORDER BY rank";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$styles[] = "$line[ID]^$line[style]";
}
$query = "SELECT * FROM belt_options";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$options[] = "$line[ID]^$line[option]";
}
$query = "SELECT * FROM colors";
$result = mysql_query($query);
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$colors[] = "$line[code]^$line[color]";
}
function belt_colors($ex_color_code) {
global $colors, $belt_size;
$color_options = "\n";
return $color_options;
}
function belt_styles($style_id) {
global $styles, $belt_size;
$style_options = "\n";
return $style_options;
}
function belt_options($option_id) {
global $options, $belt_size;
$options_options = "\n";
return $options_options;
}
function belt_sizes($size_id) {
$size_options = "\n";
return $size_options;
}
?>
:: Welcome to Falconhead - Boots - Belts - Buckles ::