Where to put ; in this code

Asked

Viewed 151 times

-2

        <p><b>Alvará: </b></p>
     <p>Numero: &nbsp;&nbsp;&nbsp;&nbsp;        Validade:   &nbsp;&nbsp;&nbsp;&nbsp;        Anexo:</p>';
    Echo' <p>'.$exibe["AlvaraNumero"].' 
        &nbsp;&nbsp;&nbsp;&nbsp;  ' 
        if ($exibe['AlvaraValidade']) { 
                                        if   (strtotime($exibe['AlvaraValidade']) < time()) 
                                        {
            echo '<span style="color:red">'.$exibe['AlvaraValidade'].'</span>';
            } else {
            echo $exibe['AlvaraValidade'];
            }
            } else { 
            echo 'N/D';
            }
            '&nbsp;&nbsp;&nbsp;&nbsp;  ' 
            echo '<a href="MostrarAlvara.php?id=' . $exibe['id'] . '">Ver PDF </a></p>

I am experiencing an error Parse error: syntax error, Unexpected 'if' (T_IF), expecting ',' or ';' in In this piece of code:

     Echo' <p>'.$exibe["AlvaraNumero"].' 
        &nbsp;&nbsp;&nbsp;&nbsp;  ' 
        if ($exibe['AlvaraValidade']) { 
  • Your code is weird. Using whitespace that way is usually a sign of something being done the wrong way. Anyway, before your first if, missing point and comma ;.

  • I’m doing this because I can’t put tables inside tab’s so I’m trying out the white space

  • 9

    This question seems to be discounted because it is about a typographical error of little or no value to future visitors.

  • @Brasofilo I understand your comment about this post, and I know that to maintain quality, this kind of thing should not occur. But there are people who are really starting now! Instead of just closing the question and leaving the guy without the "answer" of anything, help him as I did just below. Really his question can not help anyone, but an answer where you will "fix" his code, I think is always welcome and always well seen by beginners in programming...

  • @Douglasbernardino, the site is for professional programmers and enthusiasts. And no, there’s no problem helping beginners with elementary mistakes. But it is also good to signal to future visitors (target audience of the site) that this type of question does not belong to the scope of the site. If the question is closed and you still want to help, just post a comment summarizing the solution. . . . . . Anyway, if you want to extend the debate, open a question in [meta] ;)

  • @Brasofilo no, it’s all understood :D

Show 1 more comment

2 answers

5


Dude, I advise you on instead of putting this lot of "&nbsp" to do the spacing between words, use css in a span to set that spacing Ex:

css:

span{
 margin-left: 50px;
}

viewing code:

Numero <span> Validade </span> <span> Anexo </span>

Of course, this is just to illustrate. This is good visually and in the future you will get lost less, and will have everything more organized having it as usual.

2

Here...

'&nbsp;&nbsp;&nbsp;&nbsp;  '

do

echo '&nbsp;&nbsp;&nbsp;&nbsp;  ';

Browser other questions tagged

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