www.webdeveloper.com
Results 1 to 6 of 6

Thread: Unexpected $end

  1. #1
    Join Date
    Nov 2005
    Location
    India
    Posts
    336

    Unexpected $end

    I would desperately appreciate some help!

    Code:
    <?php                  
     // 1. Define an array of allowed $_GET values:
        $pass = array('faf-getting-started','faf-rules','faf-ideas','faf-etc');
    
    // 2. If the page is allowed, include it: 
        if (in_array($_GET['p'], $pass)) { 
         include ('page/' . $_GET['p'] . '.php');
       } 
    
    // 3. If there is no $_GET['p'] defined, then serve the homepage:
        elseif (!isset($_GET['p'])) {
         include ("index.php");
        }  
    
    // 4. If the page is not allowed, send them to an error page:
        else {
         // This sends the 404 header:
          header("HTTP/1.0 404 Not Found");
         // This includes the error page:
          include ("inc/error.php"); */
    ?>
    It is returning an unexpected $end error. I am totally new today to PHP, so go easy on me!

  2. #2
    Join Date
    Aug 2004
    Location
    Ankh-Morpork
    Posts
    18,923
    Looks like no closing "}" for the final ELSE block. Also, the "*/" at the end of the penultimate line appears not to belong there.
    "Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
    ~ Terry Pratchett in Nation

    eBookworm.us

  3. #3
    Join Date
    Mar 2010
    Posts
    2,803
    Oooooops.....!!!

    I can't type as fast as you NogDog

    My post was much the same
    Last edited by tirna; 03-12-2010 at 11:18 PM. Reason: Basically repeated previous post

  4. #4
    Join Date
    Nov 2005
    Location
    India
    Posts
    336
    Fantastic! Up till 5am last night, I am SO glad I can get it all working now. I can't believe it was only an error as stupid as that - I am a noob to PHP, but not to coding in general!
    Last edited by klanga2049; 03-13-2010 at 07:59 AM.

  5. #5
    Join Date
    Nov 2009
    Posts
    61
    That has got to be one of the most irritating errors. You just have to look through your code for missing curly-braces. lol

  6. #6
    Join Date
    Mar 2010
    Posts
    97
    i count them when that happens.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles