Hi, I made a page that searches the products registered and then the results appear on the page resultados.php.
I would like the results.php page to be able to make a more exact query as soon as the lower price appears first, to have the option to choose the new or used product, to appear physical or legal person.
I put my code in pastebin: link
<?php include 'header.php'; ?>
<header class="docs-top">
<div class="container docs-header">
Todos os resultados
</div>
</header>
<section>
<div class="container">
<?php
require 'conexao.php';
$produto = $_POST['produto'];
$sql = mysql_query("SELECT * FROM usuario where produto LIKE '%".$produto."%' ");
// SELECT preco FROM usuario ORDER BY preco ASC
$row = mysql_num_rows($sql);
if ($row > 0) {
while ($linha = mysql_fetch_array($sql)) {
$produto = $linha['produto'];
$bairro = $linha['bairro'];
$preco = $linha['preco'];
$telefone = $linha['telefone'];
$nome = $linha['nome'];
$estado = $linha['estado'];
}
} else {
echo "Nenhum resultado encontrado";
}
?>
<div class="well recomentadion clearfix">
<h1>Pesquisar</h1>
<form action="" method="POST">
<fieldset>
<div class="form-group col-md-3">
<label class="" for="advertisement">Título do Anúncio </label>
<div class="control mr-30">
<input type="text" id="title" name="title" class="form-control" value="" placeholder="Título" data-original-title="" title="">
</div>
</div>
<div class="form-group col-md-3">
<label class="" for="advertisement">Novo/Usado</label>
<div class="control mr-30">
<select class="form-control">
<option>Novo</option>
<option>Usado</option>
</select>
</div>
</div>
<div class="form-group col-md-3">
<label class="" for="advertisement">Empresa/P. fisica</label>
<div class="control mr-30">
<select class="form-control">
<option>Todos</option>
<option>Empresa</option>
<option>Pessoa fisica</option>
</select>
</div>
</div>
<div class="form-group col-md-3">
<label class="" for="advertisement">Ordernar por Preço</label>
<div class="control mr-30">
<select class="form-control">
<option>Menor preço</option>
<option>Maior preço</option>
</select>
</div>
</div>
<div class="clear"></div>
<input type="submit" style="margin-top:20px;" name="submit" class="btn btn-primary pull-right" value="Pesquisar">
</fieldset>
</form>
</div>
<!-- produto -->
<div class="bs-docs-example">
<table class="table table-bordered">
<tbody>
<tr>
<td align="center">:<img src="http://wcloudstatic.s3.amazonaws.com/img/no_image.jpeg"width="150" height="150" /></td>
<td><?php echo ".$produto"; ?> <br><br> <?php echo ".$bairro"; ?> - <?php echo ".$estado"; ?><br> <?php echo ".$nome"; ?> - <?php echo ".$telefone"; ?></td>
<td><?php echo ".$preco"; ?></td>
</tr>
</tbody>
</table>
</div>
<!-- /produto -->
</div>
</section>
<?php include 'footer.php'; ?>