Skip line in HTML / CSS / PHP table

0

Hello

Good morning, good afternoon or good evening!

I have a little problem at a time and I only realized now (after about 10 pages of that type), I have a page that lists all the data in the table on the boards (listarplacas.php) and it prints all the results according to with the "SELECT * FROM ESQUETCH" command, my problem is that because the printed table has 'titles' (TYPE, TRANSACTION, SIZE, QUANTITY) the first result is always hidden by titles, how can I display query results from the second line?

Images that help describe the problem:

BANK CONSULTATION USING THE ABOVE COMMAND

BANKQUESTIONWITHTHESAMECOMMANDABOVEBUTPRINTEDWITHPHP/CSS/HTML

Ifyoufixthefirstresult"is eaten" by the titles (TYPE, TRANSACTION, SIZE, QUANTITY) of the table, sometimes it is a miserable beast that I am not realizing if you can help me !!

PAGE CODE: listarplacas.php

    <CDOCTYPE html>
<html>
    <head>
    <meta charset="utf-8">
    <title>ESTOQUE DE PLACAS</title>
    <link rel="stylesheet" type="text/css" href="estilo/estilo.css">
    </head>
<body>

    <?php
    include "config/cabecalho.php";
    ?>


    <div class="container">
        <div class="titulo-principal">ESTOQUE DE PLACAS</div>
            <button value="VOLTAR" class="botao" onClick="history.go(-1)"><img src="imagens/iconevoltar.png" class="img-botao"> VOLTAR</button>
            <button value="ATUALIZAR" class="botao" onClick="history.go(0)"><img src="imagens/iconeatl.png" class="img-botao"> ATUALIZAR</button>
            <br>
            <br>
            <hr>
            <br>
<?php

    include "config/conectar.php";

            $sql = "SELECT * FROM ESTOQUECVISUAL";

                $resultado = mysqli_query($conexao,$sql);

                if(mysqli_num_rows($resultado)>0){

                    $linha = mysqli_fetch_assoc($resultado);

                //TABELA ESTOQUECVISUAL (PLACAS - comunicação visual)
                $id = $linha["ID"];
                $tipo = $linha["TIPO"];
                $transacao = $linha["TRANSACAO"];
                $tamanho = $linha["TAMANHO"];
                $quantidade = $linha["QUANTIDADE"];

                }
?>
<table border="1" style="border-collapse: collapse" width="60%">
                <tr class="cabecalho-tabela">
                  <td width="20%">TIPO</td>
                  <td>TRANSAÇÃO</td>
                  <td>TAMANHO</td>
                  <td>QUANTIDADE</td>
                  <td width='2%'></td>
                </tr>

<?php
            while($linha = mysqli_fetch_assoc($resultado)){
                $tipo = $linha['TIPO'];
                $transacao = $linha['TRANSACAO'];
                $tamanho = $linha['TAMANHO'];
                $quantidade = $linha['QUANTIDADE'];
                echo"

                    <tr>
                      <td>$tipo</td>
                      <td>$transacao</td>
                      <td>$tamanho</td>
                      <td>$quantidade</td>
                      <td><a href='alterarestoqueplacas.php?id=$id'><img src='imagens/iconeditar.png' /></a></td>
                    </tr>

                ";
            }
     ?>
            </table>
                  <br>
                  <hr>
                  <br>
                  <br>
    <?php
    include "config/rodape.php";
    ?>

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

If something is missing I'll add later, I'm a layman on the subject ...

    
asked by anonymous 10.01.2018 / 23:18

1 answer

1

It is not showing the first line because you are consuming it in if and you are not using it, giving echo .

Just delete this if , or just follow the while / table if select

listarplacas.php

<DOCTYPE html>
<html>
    <head>
    <meta charset="utf-8">
    <title>ESTOQUE DE PLACAS</title>
    <link rel="stylesheet" type="text/css" href="estilo/estilo.css">
    </head>
<body>

    <?php
    include "config/cabecalho.php";
    ?>


    <div class="container">
        <div class="titulo-principal">ESTOQUE DE PLACAS</div>
            <button value="VOLTAR" class="botao" onClick="history.go(-1)"><img src="imagens/iconevoltar.png" class="img-botao"> VOLTAR</button>
            <button value="ATUALIZAR" class="botao" onClick="history.go(0)"><img src="imagens/iconeatl.png" class="img-botao"> ATUALIZAR</button>
            <br>
            <br>
            <hr>
            <br>
<?php

    include "config/conectar.php";

            $sql = "SELECT * FROM ESTOQUECVISUAL";

                $resultado = mysqli_query($conexao,$sql);
?>
<?php if(mysqli_num_rows($resultado)>0): ?>
    <table border="1" style="border-collapse: collapse" width="60%">
                <tr class="cabecalho-tabela">
                  <td width="20%">TIPO</td>
                  <td>TRANSAÇÃO</td>
                  <td>TAMANHO</td>
                  <td>QUANTIDADE</td>
                  <td width='2%'></td>
                </tr>

    <?php
            while($linha = mysqli_fetch_assoc($resultado)){
                $tipo = $linha['TIPO'];
                $transacao = $linha['TRANSACAO'];
                $tamanho = $linha['TAMANHO'];
                $quantidade = $linha['QUANTIDADE'];
                echo"

                    <tr>
                      <td>$tipo</td>
                      <td>$transacao</td>
                      <td>$tamanho</td>
                      <td>$quantidade</td>
                      <td><a href='alterarestoqueplacas.php?id=$id'><img src='imagens/iconeditar.png' /></a></td>
                    </tr>

                ";
            }
     ?>
            </table>
                  <br>
                  <hr>
                  <br>
                  <br>

<?php endif; ?>
    <?php
    include "config/rodape.php";
    ?>

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

* obs: It is not good practice to mix the code like this, try separating select / logic from the html     

11.01.2018 / 00:05