List MySQL data with PHP and Bootstrap

-2

Hello, I'm having difficulty listing values from a table, I think it's a syntax error, because neither the html data appears, it follows 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>
    
asked by anonymous 29.09.2018 / 13:52

1 answer

0

I found the solution: while .

while($linha = mysql_fetch_array($dados))
    
09.10.2018 / 15:17