mercredi 11 octobre 2017

syntax error, unexpected T_ELSE - could anyone help me?


I'm writing a code, and now when I write a "if" or "switch" the code will always fail! The problem is, I really don't know where's the error! Could anyone please find it?

if($num_conts == 0){
        ?>
        <td colspan="3" align="center">
        <?
            if($userinfo['mvd_alu'] == 1){
        ?>
        <font size="+2">Sorry we do not have the content</font>
        <?php
            }else{
        ?>
        <font size="+2">Sorry, the content is not available for you. </font><p><font size="+1">There are <?php echo $num_contall; ?> contents for our members. Become a member!</font>
        <?php
            }
     ?>
        </td>
        <?php
    }else{
...

I get always this error:

Parse error: syntax error, unexpected T_ELSE...

In the last line "}else{". I tried to write a switch and I got the error "unexpected T_CASE" for "case 2".

if($num_conts == 0){
        ?>
        <td colspan="3" align="center">
        <?
            switch($userinfo['mvd_alu']){
                case 1:
        ?>
        <font size="+2">case 1</font>
        <?php
            break;
            case 2:
        ?>
        <font size="+2">case 2</font>
        <?php
        break;
            }
     ?>
        </td>
        <?php
    }else{
...

Could anyone please tell me where's the problem? Thanks!

Aucun commentaire:

Enregistrer un commentaire