1
The Following error appears when trying to instantiate and call a certain method:
Fatal error: Uncaught Error: Class 'Usuario' not found in C: xampp htdocs Reported projects.php:126 Stack trace: #0 {main} thrown in C: xampp htdocs Project reports.php on line 126
The first screen contains the search form and the second, is where the result will be presented.
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 mistake 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();
}
}
?>
Remember to put up the attribution sign (
=
) along those lines$Usuario new Usuario();
. you don’t need to delete the question and ask it again, just make an edit.– rray
@rray you could put as a response to ask so much I as others can benefit .
– allan araujo
That solved the problem?
– rray
No , still not showing anything on the screen , type gave an echo "<pre>"; print_r($Usuario); Exit; and still nothing appears .
– allan araujo
If you give a
print_r($listaDados)
something comes up?– rray
No , appears blank screen also .
– allan araujo
@rray worked out by putting the = in the line you do that , thank you
– allan araujo