0
Hello I am creating a system of envy and is always giving this mistake ,Fatal error: Uncaught Error: Class 'cRelatorios' not found in C:\xampp\htdocs\Projetos\relatorios.php:170 Stack trace: #0 {main} thrown in C:\xampp\htdocs\Projetos\relatorios.php on line 170
I wonder how I can remove it follows my system code below.
<?php
function RetornaAtualizacoes($etor,$host,$month){
if($_SERVER['REQUEST_METHOD'] == 'POST') {
try {
$Query = "SELECT
s.setor,
s.usuario,
s.hd,
s.memoria,
s.cd,
s.placam,
s.host,
s.monitor,
s.nobreak,
s.placar,
s.placav
FROM setor
";
include_once $_SESSION['pmodel'].'Projetos/index.php';
$p_sql = MysqlConnection::getInstance()->prepare($Query);
$_retorno = array();
if($p_sql->execute()) {
while ($_result = $p_sql->fetch(PDO::FETCH_ASSOC)) {
$_retorno[] = $_result;
}
}
return $_retorno;
} catch (PDOException $e) {
echo $e->getMessage();
}
}
}
?>
<div>
<table width="100%" CELLSPACING="0" CELLPADDING="2" BORDER="1" class='tabelaProt'>
<thead>
<tr>
<th>Setor</th>
<th>Usuário</th>
<th>Hd</th>
<th>Memória</th>
<th>Processador</th>
<th>Cd/Dvd</th>
<th>Hd</th>
<th>Memória</th>
<th>Setor</th>
<th>Usuário</th>
<th>Hd</th>
<th>Memória</th>
</tr>
</thead>
<tbody>
<?php
//Instanciando a classe
$cRelatorios = new cRelatorios();
$relatorio = $cRelatorios->RetornaAtualizacoes($etor,$host,$month);
if(!empty($relatorio)){
foreach($relatorio as $value){
// echo "<pre>"; print_r($value); exit;
echo "<tr>";
echo "<td><center>". $value["setor"] ."</center></td>";
echo "<td><center>". $value["usuario"] ."</center></td>";
echo "<td><center>". $value["hd"] ."</center></td>";
echo "<td>". $value["memoria"] ."</td>";
echo "<td>". $value["processador"] ."</td>";
echo "<td><center>". $value["cd"] ."</center></td>";
echo "<td><center>". $value["placam"] ."</center></td>";
echo "<td>". $value["host"] ."</td>";
echo "<td>". $value["monitor"] ."</td>";
echo "<td><center>". $value["nobreak"] ."</center></td>";
echo "<td><center>". $value["placar"] ."</center></td>";
echo "<td>". $value["placav"] ."</td>";
echo count($relatorio);//Quero que imprima só uma vez dentro do <td>
echo "</tr >";
}
}
?>
The error happens because the file where the class is set has not been imported, try to include at the beginning of the file a include or require and see if it works
– Denis Rudnei de Souza
but at what start of the query or the one you will print on the screen ? @Denisrudneidesouza
– allan araujo
At the very beginning of the file where the error occurs you include the file in which cRelators is set
– Denis Rudnei de Souza