I need to make the function query "clients" be entered in the "getimtems" function to be able to filter the data Here I get the query:
clientes() {
this.userData.accion="consultaclientes";
this.restprovider.Registro(this.userData).then((result) => {
this.data = result;
console.log(this.data);
}, (err) => {
this.presentToast(err);
});
}
The result of the query I need to enter in this function:
getItems(ev) {
this.clientes();
var val = ev.target.value;
// if the value is an empty string don't filter the items
if (val && val.trim() != '') {
this.result = this.result.filter((result) => {
return (item.toLowerCase().indexOf(val.toLowerCase()) > -1);
})
}
}
This is the query I do in php:
case 'consultaclientes':
$nombre = $request->nombre;
$sql2=("SELECT * FROM 'cliente' WHERE nombre = '$nombre'" );
$resultado = $mysqli->query($sql2);
//$row1= $resultado->fetch_array();
$json_array= array();
while($fila=mysqli_fetch_assoc($resultado)){
$json_array[]=$fila;
};
echo json_encode($json_array);
exit(0);
break;