Good afternoon
I have the following code
<?php
include_once("con.php");
$pdo = conectar();
$data = file_get_contents("php://input");
$data = json_decode($data);
$idempresa = $data->idempresa;
$subcategoria = "Recebimento";
$buscaContaEntrada=$pdo->prepare('SELECT * FROM conta WHERE empresa_idempresa=:idempresa AND subcategoria=:subcategoria');
$buscaContaEntrada->bindValue('idempresa', $idempresa);
$buscaContaEntrada->bindValue('subcategoria', $subcategoria);
$buscaContaEntrada->execute();
while ($linha=$buscaContaEntrada->fetch(PDO::FETCH_ASSOC)) {
$return[] = array(
'idconta' => $linha['idconta'],
'conta' => utf8_encode($linha['conta']),
'idsubcategoria' => utf8_encode($linha['subcategoria_idsubcategoria']),
);
}
echo json_encode($return);
?>
But I need to get the data idsubcategory, make another select, in the database, and the result, play within $ return ... How can I do this?