Skip to content

Commit

Permalink
Corrigindo issue [#233]
Browse files Browse the repository at this point in the history
  • Loading branch information
FlameOff committed Sep 25, 2024
1 parent a9f3cc5 commit d8544e7
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions html/saude/exibir_exame.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<?php
require_once'../../dao/Conexao.php';
$pdo = Conexao::connect();
try{
$sql = 'select * from saude_exame_tipos';
$stmt = $pdo->prepare($sql);
$stmt->execute();

$resultado = array();
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
$resultado[] = array('id_exame_tipo'=>$row['id_exame_tipo'],'descricao'=>$row['descricao']);
}

$sql = 'select * from saude_exame_tipos';
$stmt = $pdo->query($sql);
$resultado = array();
while ($row = $stmt->fetch()) {
$resultado[] = array('id_exame_tipo'=>$row['id_exame_tipo'],'descricao'=>$row['descricao']);
echo json_encode($resultado);
} catch (PDOException $e) {
// Em caso de erro, você pode registrar ou lidar com a exceção de forma apropriada
error_log('Database error: ' . $e->getMessage());
echo json_encode(array('error' => 'Unable to fetch data'));
}
echo json_encode($resultado);
?>

0 comments on commit d8544e7

Please sign in to comment.