0
I developed a function that searches the bank for a client by ID:
function buscaId ($id,$conexao){
$resultados= array();
$query= "select * from cliente where id like '$id%' ";
$resultado= mysqli_query($conexao,$query);
while ($resultado_cliente = mysqli_fetch_assoc($resultado)) {
array_push($resultados, $resultado_cliente);
}
return $resultados;
}
But when I type "%%" ou "VAZIO "
in "Search", it brings all customers from the bank.
How do I disable this? The bank will have 7,000 lines.
creates a condition (
IF
) in the function if$id
for empty already returns (return
) and does not perform the rest;– Don't Panic
if it is by ID why search with like?
– arllondias
Thanks arllondias has no need of the LIKE I took and solved kkk
– FelipeM13