Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End unexpected T_ELSE

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #36551
    fectio1
    Member

    Im getting an unexpected T_ELSE and I cant figure it out. Any help appreciated.


    ID, "video", true))) { ?>
    ID, "video", true); ?>


    ID, "image", true))) { ?>
    $images = array(
    'example.jpg',
    'example.jpg',
    'example.jpg',
    );
    $image = $images[array_rand($images)];
    $output = "";
    echo $output;
    ?>
    #96380
    bungle
    Member

    $image = $images[array_rand($images)];

    only needs to be

    $image = array_rand($images);

    #96382
    fectio1
    Member

    still getting same error.

    #96394
    bungle
    Member

    Is this the only code? It seems like your if/else statement is being broken. Is there additional code or hidden characters between the close of the if and the start of the else if statement?

    Can you remove the php tags and seemingly blank line that separate them so you end up with } else if { to see if that fixes it?

    #96395
    fectio1
    Member

    Other then some divs for styling. That is it. and I tried you suggestion on the $image, but it did not work. Thanks for taking the time to look at it. For now, I just changed the “else if” to an “if”.

    #96444
    TheDoc
    Member

    That’s because I’m pretty sure it’s ‘elseif’, not ‘else if’. I’m a PHP noob, though!

    #96457
    fectio1
    Member

    You would be correct unless you use curly brackets which I did. But elseif is the correct format. :)

    What I read

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Back End’ is closed to new topics and replies.