MySQL Forums
Forum List  »  Spanish

Al recibir consulta no salen ñ ni tildes
Posted by: Ric Rey
Date: February 19, 2021 05:30PM

Hola, al recibir la consulta que hago de la base de datos me salen símbolos en lugar de las "ñ" y las tildes...

pero en el php html está configurado el utf8 parece que es al momento de llamar a la base de datos...

<?php

$nombre_Cliente = NULL;

$buscarPor = trim(filter_input(INPUT_POST,'Criterio', FILTER_SANITIZE_STRING));
$where = trim(strtolower(filter_input(INPUT_POST, 'itBuscar', FILTER_SANITIZE_STRING)));

$buscar = true;
if (empty($where))
{
$buscar = false;
}
if ($buscarPor === 'Email')
{
if(!filter_var($where, FILTER_VALIDATE_EMAIL))
{
$buscar = false;
}
}

$sq1 = "SELECT os.idOs, cli.nomecliente, os.datainicial, os.datafinal, os.status, os.observacoes, os.laudotecnico
FROM clientes cli
INNER JOIN os ON os.clientes_id = cli.idClientes";

if ($buscar)
{
$datoBuscar = "'".$where."'";
if ($buscarPor === 'Documento')
{
// $query = $sq1. " WHERE CLI.documento = $datoBuscar";
$query = $sq1. " WHERE cli.documento = '$datoBuscar'";
}
else
{
$query = $sq1. " WHERE cli.email = $datoBuscar";
}

// $cn = new mysqli('localhost', 'root', '', 'stecnico');
$cn = new mysqli('localhost', 'nombreusuario', 'contraseña', 'nombrebd') or exit( mysqli_connect_error() );
// $rs = $cn->query($query);
$rs = $cn->query($query) or exit( $cn->error );
$nombre_Cliente = $rs->fetch_assoc()['nomecliente'];
$vecresultado = array();
while ($fila = $rs->fetch_row())
{
//$nombre_Cliente = ($fila[1]);
array_push($vecresultado, $fila);
}

mysqli_free_result($rs);
mysqli_close($cn);
}
else
{
header("Location: /stecnico/consultaros/index.php?Error=s");
}
?>

Options: ReplyQuote


Subject
Views
Written By
Posted
Al recibir consulta no salen ñ ni tildes
57
February 19, 2021 05:30PM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.