Results 1 to 5 of 5

Thread: parse error

  1. #1
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default parse error

    Somebody please help out; I'm at my wits end with this one.

    I'm getting a parse error message from my server:
    Parse error: syntax error, unexpected T_STRING in [pathtofile] on line 137

    This is line 137:
    Code:
    $pic_file = "zz_gallery/gallery_" . $max_pictures . ".php";

    These are lines 134 - 160:
    Code:
    <?php
    
    $pic_file = "zz_gallery/gallery_" . $max_pictures . ".php";
    
    if (file_exists($pic_file)) {
    
         $tmp = file_get_contents($pic_file);
         foreach (range(0, $max_pictures-1) as $key) {
              $uri = $pic = $picture_set[$key];
              if (!$pic) {
                   $thumb = "<img src='/models/thumb.php5?uri=blank' height='125' width='100' border='0'/>";
              } else {
                   $thumb = "<a href='$pic'><img src='/models/thumb.php5?uri=$pic' height='125' width='100' border='0'/></a>";
              }
              $tmp = str_replace("[$key]", $thumb, $tmp);
         }
         echo $tmp;
    
    } else {
    
         echo "<table cellspacing='15' cellpadding='0' border='0'>\n\t<tr>\n";
         foreach ($picture_set as $pic) {
              echo("\t\t<td><a href='$pic'><img src='/models/thumb.php5?uri=$pic' height='125' width='100' border='0'/></a></td>\n");
         }
    }
    
    ?>
    I just can't figure out what the problem is!!!
    Last edited by kosi; 08-24-2007 at 06:40 AM.

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,156
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Weird. I don't see it either. Could there be a larger problem, like an open loop?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    it looks like you have the correct syntax, but if you are using PHP5 you could also do
    PHP Code:
    $pic_file "zz_gallery/gallery_{$max_pictures}.php"
    you should get the same error, though, but if you wanna try you can go for it.

    as djr said, it could be an open loop, or possibly even an extra open bracket somewhere... the error occured on 137, and thus aborted, so really it would be better if we were to see lines 0-136 to let you know what's causing the error

  4. #4
    Join Date
    May 2006
    Location
    New York City
    Posts
    77
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You were right; the issue was an open string on line 96. I wouldn't have thought to look up that far, lol. Thanks.

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    if you are using PHP5 you could also do
    Not just PHP5; that also works on at least PHP4.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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