I have a car sales site to do, but I'm having a hard time on the part of filters where I need the maximum price and minimum price, so I first made a range slider but I can not make it reduce the car options by lowering the price.
DoallcarsstayaslongasIonlygetcarswiththepricewithinlimits?
<?phpinclude'conn.php';mysqli_set_charset($con,"utf-8");
$result = mysqli_query($con,"SELECT preco from carros_desc where preco = (SELECT preco FROM carros_desc ORDER BY preco ASC LIMIT 1)");
while($row = mysqli_fetch_array($result)){
$preco = $row['preco'];
echo "<input type='range' name='price-min' id='price-min' value='$preco' min='0' max='100000'>";
}
$result2 = mysqli_query($con,"SELECT preco from carros_desc where preco = (SELECT preco FROM carros_desc ORDER BY preco DESC LIMIT 1)");
while($row2 = mysqli_fetch_array($result2)){
$preco2 = $row2['preco'];
echo "<input type='range' name='price-min' id='price-min' value='$preco2' min='0' max='100000'>
</div>
</div><div id='cars'>";
}
$result3 = mysqli_query($con,"SELECT carros.modelo, carros_img.img, carros_desc.preco, carros_desc.comb FROM carros, carros_desc, carros_img WHERE carros.id = carros_desc.id_fk and carros.id = carros_img.id_fk and carros_desc.preco BETWEEN '$preco' and '$preco2' order by carros_desc.preco ASC");
while($row3 = mysqli_fetch_array($result3)){
$img = $row3['img'];
$modelo = $row3['modelo'];
$comb = $row3['comb'];
$preco3 = $row3['preco'];
echo "<div class='img'>
<a target='_blank' href='imagens/viaturas/$img'>
<img src='imagens/viaturas/$img' alt='$img' width='300' height='200'>
</a>
<div class='desc'>
<p>$modelo</p>
<p>$comb</p>
<p>$preco3</p>
</div>
</div>";
}
mysqli_close($con);
?>