1
My code should take data from the database, and assign it to an array, but when I list this array, the data does not enter the fields
<?php
include_once '../../classes/Conexao.php';
use classes\Conexao;
header('Content-Type: text/html; charset=iso-8859-1');
$id_veiculo = "1654641106";
$cpf = "25836914766";
$conn = new Conexao();
$link = $conn->getLink();
$select = "SELECT veiculo.PLACA , veiculo.NOME as NOME_VEICULO,cliente.NOME as NOME_CLIENTE,cliente.TELEFONE FROM `veiculo` INNER join cliente on veiculo.CPF = cliente.CPF WHERE cliente.CPF =$cpf AND veiculo.ID_CARRO =$id_veiculo ";
$resultado_consulta = mysqli_query($link, $select);
while( $row = mysqli_fetch_assoc($resultado_consulta) )
{
echo $row['NOME_CLIENTE'];
echo "<BR>";
echo $row['NOME_VEICULO'];
echo "<BR>";
echo $row['TELEFONE'];
echo "<BR>";
echo $row['PLACA'];
}
$resultado[] = array(
'nome_cliente' =>$row['NOME_CLIENTE'],
'cpf' =>$cpf,
'telefone' =>$row['TELEFONE'],
'nome_veiculo' =>$row['NOME_VEICULO'],
'placa' =>$row['PLACA'],
);
echo(json_encode($resultado));
?>
This listing I did just to make sure that the query was working, and is, but the assignment to the array does not run. the result of this code is like this[ Note that the value of the $Cpf variable that was started at the beginning of the code is assigned, but the result of the query is not
Yeah, after I asked who I saw it was for that, but thanks for the attention you saw
– Igor
Thank you for being able to help
– Wees Smith