<?php
require_once "../include/mysql.inc2.php";
$q = $_GET["q"];
if(!$q) return;
$sql = selecionaBD("produtos", "WHERE descricao LIKE '$q%' OR gtin_ean LIKE '$q%' ORDER BY descricao LIMIT 5") or die("Erro ao consultar");
$total = totalBD($sql);
if ($total > 0){
while($res = listalinhas($sql)){
$desc = $res['descricao'];
$qnt = "1";
$vlr = $res['preco_v'];
echo "<input type=\"text\" id=\"bitem_1\" value=\"$desc\" style=\"display:none;\" />";
echo "<input type=\"text\" id=\"bqnt_1\" value=\"$qnt\" style=\"display:none;\" />";
echo "<input type=\"text\" id=\"bvlr_1\" value=\"$vlr\" style=\"display:none;\" />";
echo "<a href=\"javascript:func();\" class=\"res\" id=\"res\" onclick=\"passar_1();\">";
echo "<div class=\"nome\"><strong>$desc</strong> \n";
echo "</div>";
}
}else{
echo "<div class=\"nome\">Nenhum Resultado </div> \n";
}
?>