if(isset($_POST['brend'])) {
$brend_filter = implode("','", $_POST['brend']);
$query = "SELECT * FROM shiny WHERE brend = '".$brend_filter."' ORDER BY weight";
}
if(isset($_POST['width'])) {
$width_filter = implode("','", $_POST['width']);
$query = "SELECT * FROM shiny WHERE width = '".$width_filter."' AND brend = '".$brend_filter."' ORDER BY weight";
}
if(isset($_POST['height'])) {
$height_filter = implode("','", $_POST['height']);
$query = "SELECT * FROM shiny WHERE height = '".$height_filter."' AND width = '".$width_filter."' AND brend = '".$brend_filter."' ORDER BY weight";
}
if(isset($_POST['diametr'])) {
$diametr_filter = implode("','", $_POST['diametr']);
$query = "SELECT * FROM shiny WHERE diametr = '".$diametr_filter."' AND height = '".$height_filter."' AND width = '".$width_filter."' AND brend = '".$brend_filter."' ORDER BY weight";
}
$statement = $db->prepare($query);
$statement->execute();
$result = $statement->fetchAll();
$total_row = $statement->rowCount();
$out = '';
if($total_row > 0){
foreach($result as $row) {
$out .='
<div class="cart ' . $row['season'] . ' ' . $row['ship'] . '">
<img src="' . $row['image'] . '">
<p class="brend"><b>' . $row['brend'] . '</b></p>
<p class="name"><b>' . $row['name'] . '</b></p>
<p class="width"><b>Ширина: ' . $row['width'] . '</b></p>
<p class="height"><b>Высота: ' . $row['height'] . '</b></p>
<p class="diametr"><b>Диаметр: ' . $row['diametr'] . '</b></p>
<p class="season"><b>Сезон: ' . $row['season'] . '</b></p>
<p class="weight"><b>Вес: ' . $row['weight'] . '</b></p>
</div>
';
}
}
else {
$out = '<h3>No Data Found</h3>';
}
echo $out;