Notice: Undefined variable: funcionarios in
Com resolver Notice: Undefined variable: funcionarios in
esse é meu código
<?php
include_once $_SESSION['pview'] . '/header.php';
include_once $_SESSION['pview'] . '/menu.php';
include_once $_SESSION['pcontroller'] . '/cRelatorios_class.php';
class Relatorios {
public function GeraRelatorioDeFuncionario(){
$RetornaUsuarios = $cRelatorios->RetornaUsuarios();
?>
class Relatorios {
public function GeraRelatorioDeFuncionario(){
$cRelatorios = new cRelatorios();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="distribution" content="Private">
<meta name="rating" content="Sistema">
<meta name="copyright" content="UnimedMamanaus">
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<title></title>
</head>
<body>
<center>
<br/>
<b>RELATÓRIO DE FUNCIONÁRIO</b>
</center>
<br/>
<hr/>
<table width="100%" CELLSPACING="0" CELLPADDING="2" BORDER="1" class='tabelaRelat'>
<thead>
<tr>
<th>NOME DO FUNCIONÁRIO</th>
<th>ENDEREÇO </th>
<th>BAIRRO</th>
<th>CIDADE</th>
<th>NÚMERO</th>
</tr>
</thead>
<tbody>
<tr>
<td><center>Funcionário</center></td>
<td><center>Endereço</center></td>
<td><center>Bairro</center></td>
<td><center>Cidade</center></td>
<td><center>Número</center></td>
</tr>
</tbody>
</table>
</div>
</div>
<hr/>
<?php
/* $relatorio new relatorio();
$relatorios = $relatorio->RetornaRelatorio(); */
//echo "<pre>"; print_r($cFuncionarios); exit;
foreach($funcionarios as $value){
// echo "<pre>"; print_r($value); exit;
echo "<tr>";
echo "<td>". $value["nome"] ."</td>";
echo "<td>". $value["end_logradouro"] ."</td>";
echo "<td>". $value["end_numero"] ."</td>";
echo "<td>". $value["end_bairro"] ."</td>";
echo "<td>". $value["end_cidade"] ."</td>";
echo "<td>". $value["fone_numero"] ."</td>";
echo "</tr>";
}
$_header = new header();
}
<h2>Relatórios</h2>
<form class="form" id="exibefuncionarios" method="post" target='_blank' action="gerar">
<fieldset>
<div style="border-radius:5px;padding:10px;">
<table class="tbl_relatorio" cellspacing='0' width='100%' border ='0'>
<tr>
<td class='label_1'>Funcionário:</td>
<td>
<select style="width: 290px;" name="codusuario" id="codusuario">
<option value=''>--Selecione--</option>
<?php foreach($lista_funcionarios as $funcionario){ ?>
<option value='<?php echo $funcionario["codusuario"]; ?>'><?php echo $funcionario["nome"]; ?></option>
<?php } ?>
</select>
</td>
</tr>
</table>
</div>
</fieldset>
<br/>
<button id="gera_rel_funcionario" class="BlueButton" type="submit">Gera Relatório</button>
</form>
</div>
</div>
e esse é o banco class cRelatorios {
class cRelatorios {
aqui vem a conexão...
....
public function RetornaUsuarios(){
$this->sql = "SELECT distinct(codusuario),nome FROM funcionarios WHERE codusuario != '37'";
try{
$search = $this->MySql->prepare($this->sql);
$search->execute();
}catch(PDOException $e){
print $e;
}
$arr=array();
while($show = $search->fetch(PDO::FETCH_ASSOC)){
$arr[] = $show;
}
return $arr;
}Discussão (11)
Carregando comentários...