The following error appears when trying to instantiate and call a particular method:
Fatal error: Uncaught Error: Class 'User' not found in C: \ xampp \ htdocs \ Projects \ reports.php: 126 Stack trace: # 0 {main} thrown in C: \ xampp \ htdocs \ Projects \ reports.php online 126
The first screen contains the search form and the second one is where the result will be displayed.
The following code is from the screen that displays the result.
<?php
require 'queryconection.php';
//Instanciando a classe
$Usuario new Usuario();
$listaDados = $Usuario->carregaSetores($setor, $host, $month);
if (!empty($listaDados)) {
foreach ($listaDados 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 "</tr >";
}
}
?>
This is my query, who can solve my error I give the point
<?php
error_reporting(-1);
ini_set('display_errors', 'On');
$servidor = "localhost";
$usuario = "root";
$senha = "";
$dbname = "cadastro";
//Criar a conexao
$link = new mysqli ("localhost", "root", "", "cadastro");
if ($link->connect_errno) {
echo"Nossas falhas local experiência ..";
exit();
}
function carregaSetores($setor,$host,$month){
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
";
$p_sql = mysql::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();
}
}
?>