I have already created a search engine with PHP in which you select a letter or word and look for it in the database. I wanted to know how to filter the data that has been extracted from my database by price, date etc ...
The code I use for my PHP search engine:
$connect = mysqli_connect("localhost", "root", "root", "restaurantes");
$output = '';
$record_per_page = 5;
if(isset($_POST['query'])){
$page = $_POST['query'];
$start_from = ($page - 1)*$record_per_page;
$sql = "SELECT * FROM restaurantes_resultado WHERE nombre
LIKE '%".$_POST["query"]."%'
OR precio LIKE'%".$_POST["query"]."%'
OR fecha LIKE'%".$_POST["query"]."%'
LIMIT 0 , 5 ";
$result = mysqli_query($connect, $sql);
if(mysqli_num_rows($result) > 0)
{
while($row = mysqli_fetch_array($result))
{
$output .= '
<div class="resultado margenes">
<div class="imagen col">
<a href="#" tittle="Imagen1" class="thumbnail"><img src="'.$row["fotos"].'"/></a>
</div>
<div class="contenido-medio col">
<div id="no-margin">
<h3 class="no-margin">'.$row["nombre"].'</h3>
<p> zona:'.$row["precio"].' </p>
</div>
</div>
<div class ="barra-vertical col">
<p> '.$row["fecha"].' </p>
</div>
</div>
';}
echo $output;
}else{
echo 'Data Not Found';
}
}