How to remove the Fatal error: Uncaught Error: Class

0

Hello, I am creating an inventory system and it is always giving this error, 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 would like to know how I can remove it, it follows the code of my system 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 >";

                                   }
    }


     ?> 
    
asked by anonymous 26.12.2016 / 17:52

1 answer

1

You need to include the class in the file.

<?php

   require 'caminho_do_arquivo/cRelatorios.class.php';

   function RetornaAtualizacoes($etor,$host,$month){
    
26.12.2016 / 19:40