Skip to content

Commit

Permalink
Resolução da issue #413
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielPintoSouza committed Jul 5, 2024
1 parent c343169 commit f8799c9
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions dao/exibir_cargo.php
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<?php
require_once'Conexao.php';
require_once 'Conexao.php';
try {
$pdo = Conexao::connect();

$sql = 'select * from cargo';
$sql = 'SELECT * FROM cargo';
$stmt = $pdo->query($sql);
$resultado = array();
while ($row = $stmt->fetch()) {
$resultado[] = array('id_cargo'=>$row['id_cargo'],'cargo'=>$row['cargo']);
$cargos = array();
$resultado = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($resultado) {
$cargos = $resultado;
}
echo json_encode($resultado);
?>

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

0 comments on commit f8799c9

Please sign in to comment.