data listing

Asked

Viewed 63 times

0

he’s just printing the first line of the database and I want you to print out all the lines .

<?php
    @session_start();
    include_once $_SERVER['DOCUMENT_ROOT'] . '/PlanejamentoEstrategico/model/indoperacionais/Indoperacionais.php';
?>

    <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">
        <title>Planilha de Indicadores Operacionais</title>
        <meta http-equiv="content-type" content="text/html;charset=utf-8" />
        <style type="text/css">.texto {color:#006400;}
        </style>
        <center><h2><p class="texto">PAINEL DE INDICADORES OPERACIONAIS UNIMED MANAUS</p></h2></center>
        <body>
        <h2>&nbsp;&nbsp;Formulario para Avaliacao Mensal - 2015 - 2016</h2>
        <h3>&nbsp;&nbsp;Area de Gestao de Pessoas</h3>
        <div class="sheet"></div>
        </div><center> 
       <style type="text/css">
       body {
    background-color: Very Light Grey ;
}
     h2 {
     border-width: medium;
     border-style: solid;
     border-color: #FFFFFF;
     background-color: Very Light Grey  ;
     }
     h3 {
     border-width: medium;
     border-style: solid;
     border-color: #DCDCDC;
     background-color: OliveDrab  ;
     }
     td {
         background-color: Silver   ;
     }
    tr {
         background-color: LightGray    ;
     }

       <div class='report'>

   </style>
  </head>
        <table border="2">
    <thead>

 <tr>
   <th>nome</th>
   <th>indicadores</th>
    <th>responvel</th>
    <th>metas</th>
</tr>
<tr>

<?php
    $ano        = $_POST["ano"];

    //Instanciando a classe
    $_model = new model_Indoperacionais();
    $_indoperacionais = $_model->RetornaIndoperacionais($ano);
     foreach($_indoperacionais as  $value){
        echo '<td>'.$value.'</td>';

     }



    ?>


 </tr>
    </table>
    </thead>

            </center>
        </div>
    </body>
</html>



class model_Indoperacionais extends MysqlConnection{


    private $indoperacionais;

    public function RetornaIndoperacionais($ano){

   if($_POST["ano"] == '2016'){
        $_indoperacional = "/pla_est_2016";
    }else{
        $_indoperacional = "/pla_est";
    }

        $Query = ("SELECT nome,indicadores,responsavel,metas FROM `iniciativas`"); 


        //while ($_indoperacionais = mysql_fecth_array($Query));
        try{
            $this->search = $this->MySql->prepare($Query);
            $this->search->bindValue(":nome", $this->indoperacionais);
            $this->search->execute();

        } catch(PDOExeption $e) {
            die($e->getMessage());
        }

        $_result = $this->search->fetch(PDO::FETCH_ASSOC);
        //print_r($_result); exit;
         return $_result ;
           //print_r($_result);
           //return (_result)
    }
}
  • 2

    Please use the button edit and I’ve identified all the code in the icon {}. Welcome to the site, it is interesting gives a read on tour to better understand how the site works.

  • fetch() return only one record or you use fetchAll() or uses fetch() with a while and at the end return that array.

  • yes , but I put it and it appeared like this name responvel targets Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array Array

  • You need to specify which key you want to print. ex echo $value['nome'];

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.