= 1) { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\" AND brand IN ({$brand_parameter}) ORDER BY (price - (price*discount/100.0)) ASC; "); } else if($price_sort == 'low-to-high' && count($valid_brands) <= 0) { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\" ORDER BY (price - (price*discount/100.0)) ASC;"); } else if($price_sort == 'high-to-low' && count($valid_brands) >= 1) { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\" AND brand IN ({$brand_parameter}) ORDER BY (price - (price*discount/100.0)) DESC; "); } else if($price_sort == 'high-to-low' && count($valid_brands) <= 0) { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\" ORDER BY (price - (price*discount/100.0)) DESC;"); } else if(count($valid_brands) >= 1) { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\" AND brand IN ({$brand_parameter}) ;"); } else { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\";"); } } else { if($price_sort == 'low-to-high') { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE brand IN ({$brand_parameter}) ORDER BY (price - (price*discount/100.0)) ASC; "); } else if($price_sort == 'high-to-low') { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE brand IN ({$brand_parameter}) ORDER BY (price - (price*discount/100.0)) DESC; "); } else { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE brand IN ({$brand_parameter}) ;"); } } if(mysqli_num_rows($all_products) >= 1) { foreach($all_products as $product) { ?>
">
$
No products

'; } } else { if($category != 'All') { if($price_sort == 'low-to-high') { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\" ORDER BY (price - (price*discount/100.0)) ASC;"); } else if($price_sort == 'high-to-low') { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\" ORDER BY (price - (price*discount/100.0)) DESC;"); } else { $all_products = mysqli_query($conn, "SELECT * FROM products WHERE category = \"$category\";"); } } else { if($price_sort == 'low-to-high') { $all_products = mysqli_query($conn, "SELECT * FROM products ORDER BY (price - (price*discount/100.0)) ASC;"); } else if($price_sort == 'high-to-low') { $all_products = mysqli_query($conn, "SELECT * FROM products ORDER BY (price - (price*discount/100.0)) DESC;"); } else { $all_products = mysqli_query($conn, "SELECT * FROM products;"); } } if(mysqli_num_rows($all_products) >= 1) { foreach($all_products as $product) { ?>
">
$
No products

'; } } ?>