Problems with While

Asked

Viewed 35 times

0

I am developing a page that should pull from the database the name of the content and the path of the HTML file that contains this content. In the database table there are two columns: content_title and content_html. This content is not in the database, only the path to the folder where the HTML file is.

Error: When pulling from the database and displaying this data in panels, it only works in the first run of while. The other panels do not show the content, only the title.

Please, could someone help me?!

<?php
    //Conexão com o banco
    include '../actions/conexao_db.php';

    //Consulta
    $consulta = mysqli_query($conexao, "SELECT * FROM disciplinas;");

    //Exibindo conteúdos em painéis
    while($exibe = mysqli_fetch_assoc($consulta)) {
        $nomeConteudo = $exibe["nomeConteudo"];
        $arquivoConteudo = $exibe["includeConteudo"];

            echo '<br><div class="panel panel-default">
                    <div class="panel-heading">' . $nomeConteudo . '</div>
                        <div class="panel-body">
                            <script>
                                $(document).ready(function(){
                                    $("#divConteudo").load("' . $arquivoConteudo . '");
                                });
                            </script>
                        </div>
                </div>';

    }                   
?>
  • 1

    Voce has to use every iteration of its while one $("#divConteudo") different, otherwise every passage Voce makes by while Voce will be changing the same div

  • Thanks for the help André Paulo, that’s right, I’ve corrected and worked right now. Sorry for the delay. Vlw!!

No answers

Browser other questions tagged

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