Good morning, I created a function to get the ids of all the processes of a table, as shown in the code below
function getProcessos()
{
$conecta = new PDO('mysql:host=localhost; dbname=processos','root','root');
$sql = "SELECT id from processo where opcao='S' limit 10";
$resultado = $conecta->prepare($sql);
$resultado->execute();
$dados = $resultado->fetchAll(PDO::FETCH_OBJ);
return $dados;
}
Now I need to filter in the processes table by the processes obtained in the above function
$processo = getProcessos();
// var_dump($processo);
foreach ($processo as $linhas) {
$linha = $linhas->id;
$sql = "select * from andamento where idprocesso=$linha limit 10";
$stmt = $conecta->prepare($sql);
var_dump($stmt);
$stmt->execute();
$dados = $stmt->fetchAll();
// var_dump($dados);
}
When I give var_dump to $ stmt it returns public 'queryString' = > string 'select * from progress where idprocesso = 5873, where it always modifies idprocesses according to the function getProcesso (); But when I give var_dump ($ data) it returns 10 empty arrays