Parse error: syntax error, unexpected end of file in [duplicate]

-3

I have an error in this section ... I do not know what can be

<?php
$sql = mysql_query("SELECT * FROM comentarios where ativo='sim' order by id DESC");
while($linha = mysql_fetch_array($sql )){
    $data_2 = $linha['data'];
    $hora_2 = $linha['hora'];
    $nome = $linha['nome'];
    $comentario = $linha['comentario'];

    $data_2 = implode("/",array_reverse(explode("-",$data_2)));
?>
<font class="data"><?php echo $data_2 ?> - <?php echo $hora_2 ?></font>
<p class="texto_comentario"><?php echo $comentario ?></p>
<p class="nome_comentario">Autor: <?php echo $nome ?></p>
<p style="border-top:#F7F7F7 1px dotted;"></p>
?>
    
asked by anonymous 01.11.2017 / 03:51

2 answers

2

You did not end the block with that WHILE command code. You are missing a key (or key, brace, curly bracket) in your } code.

<?php
    $sql = mysql_query("SELECT * FROM comentarios where ativo='sim' order by id DESC");
    while($linha = mysql_fetch_array($sql )){
        $data_2 = $linha['data'];
        $hora_2 = $linha['hora'];
        $nome = $linha['nome'];
        $comentario = $linha['comentario'];

        $data_2 = implode("/",array_reverse(explode("-",$data_2)));
    } //faltou este
?>
<font class="data"><?php echo $data_2 ?> - <?php echo $hora_2 ?></font>
<p class="texto_comentario"><?php echo $comentario ?></p>
<p class="nome_comentario">Autor: <?php echo $nome ?></p>
<p style="border-top:#F7F7F7 1px dotted;"></p>
?>
    
01.11.2017 / 12:06
1

You have missed closing a key Change the last line by

<?php } ?>
    
01.11.2017 / 11:24