List Mysql data with PHP and Bootstrap

Asked

Viewed 495 times

-2

Hello, I’m having difficulties in listing values of a table, I believe it is syntax error, because not even the html data appear, follow the code:

        $query = sprintf("SELECT * FROM entrega_cliente");
                // executa a query
            $dados = mysql_query($query, $con) or die(mysql_error());
                // transforma os dados em um array
            $linha = mysql_fetch_assoc($dados);
                // calcula quantos dados retornaram
            $total = mysql_num_rows($dados);

    ?>



    <table class="table">
        <thead>
            <tr>
                <th scope="col">codigo</th>
                <th scope="col">nome</th>
                <th scope="col">telefone</th>
                <th scope="col">cep</th>
                <th scope="col">rua</th>
                <th scope="col">número</th>
                <th scope="col">bairro</th>
                <th scope="col">cidade</th>
                <th scope="col">Status</th>

            </tr>
        </thead>
        <tbody>

            <?php

            while($linha = mysql_fetch_assoc($dados)) {
                    # code...

            ?>


            <tr>

                <td><?php echo $linha["id_entrega"] ?></td>
                <td>aa</td>
                <td>@mdo</td>
            </tr>
            <tr>

                <td><?php echo $linha['nome'] ?></td>
                <td>Thornton</td>
                <td>@fat</td>
            </tr>
            <tr>

                <td>Larry</td>
                <td>the Bird</td>
                <td>@twitter</td>
            </tr>
        </tbody>
    <?php } ?>
    </table>

1 answer

0

I found the solution: the while.

while($linha = mysql_fetch_array($dados))
  • Give more details of your solution to not gain more negativities, it happens, worth.

Browser other questions tagged

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