Parse error: syntax error, Unexpected end of file in

Asked

Viewed 2,061 times

-3

I’m having an error in this part... I don’t know what it might 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>
?>

2 answers

3

You have not closed the block that WHILE command code.
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>
?>

2

There was a key missing Trade the last line for

<?php } ?>

Browser other questions tagged

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