Skip to content

Commit

Permalink
Resolução da issue #414
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielPintoSouza committed Jul 4, 2024
1 parent 89253ff commit ebaafe7
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions dao/exibir_beneficios.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
<?php
require_once'Conexao.php';
require_once 'Conexao.php';

try {
$pdo = Conexao::connect();

$sql = 'select * from beneficios';
$stmt = $pdo->query($sql);
$resultado = array();
while ($row = $stmt->fetch()) {
$resultado[] = array('id_beneficios'=>$row['id_beneficios'],'descricao_beneficios'=>$row['descricao_beneficios']);
$sql = 'SELECT id_beneficios, descricao_beneficios FROM beneficios';
$stmt = $pdo->prepare($sql);
$stmt->execute();
$resultado = $stmt->fetchAll(PDO::FETCH_ASSOC);

if ($resultado) {
$beneficios = $resultado;
} else {
$beneficios = [];
}
echo json_encode($resultado);
?>

echo json_encode($beneficios);
} catch (PDOException $e) {
echo 'Erro ao exibir benefícios: ' . $e->getMessage();
}

0 comments on commit ebaafe7

Please sign in to comment.