unexpected T_STRING expecting "," or ";" on line 101

Discussion in 'PHP' started by jumpenjuhosaphat, Jul 29, 2006.

  1. #1
    I get the error unexpected T_STRING expecting "," or ";" on line 101 on the following, any help would be apreciated.

    echo'
    .....
    ......
       </div>
    
    //line 97
       <div class="td">
           <a href="../jennifer_aniston/jennifer_aniston.php">Jennifer Aniston&nbsp;&nbsp;&nbsp;&nbsp;</a>
       </div>
    //line 102
    
    .....
    ....
    ';
    
    PHP:
    I got the error, but this should just be echoing the html code, not parsing. Is there a rule that you can't use &nbsp; within a php string, if so, how do I escape it? For some reason php is breaking out of the echo and trying to parse the html code. I used only single quotes(') for the php, and double(") for html, I went through the entire document and found no errors.
     
    jumpenjuhosaphat, Jul 29, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Using &nbsp; is fine. The error is somewhere else but not in the code you pasted. Paste the real code and it will be easy to spot.
     
    T0PS3O, Jul 29, 2006 IP
  3. jumpenjuhosaphat

    jumpenjuhosaphat Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Okay, here it is, I've marked lines 97 and lines 102 for you to find easier, if that even helps.

    
    <?php
    
    echo'
    
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
     <title>'.$title.'</title>
     <link rel="stylesheet" type="text/css" href="../style.css"/>
     
     <meta name="description" content="'.$description.'"/>
     <meta name="keywords"    content="'.$keywords.'"/>
    
    </head>
    <body>
    
    <div class="body">
    
    <img src="'.$first.'_'.$last.'_'.$picnum.'.jpg" alt="'.$picdesc.'"/>
    
    <table>
    <tr>
    <td><a href="'.$next.'">'.$nextalt.'</a></td>
    <td><a href="'.$back.'">Back</a></td>
    <td><a href="'.$first.'_'.$last.'.php">Gallery</a></td>
    </tr>
    </table>
    
    <p>'.$picdesc.'</p>
    
    </div>
    
    <div class="header">
    <img src="../siteimages/halogo.gif" alt="HotActress.com"/>
    
    <a class="homelink" href="http://hotactress.buyyourgadgets.com"><img src="siteimages/home2.gif" alt="HOME"/></a>
    
    <div class="headerad">
    
     <script type="text/javascript"><!--
     google_ad_client = "pub-1666729901034065";
     google_ad_width = 468;
     google_ad_height = 60;
     google_ad_format = "468x60_as";
     google_ad_type = "image";
     google_ad_channel ="5355642538";
     //--></script>
     <script type="text/javascript"
       src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    
    </div>
    
    </div>
    
    <div class="navigation">
    
       <div class="th">Actresses</div>
    
       <div class="td">
           <a href="../lindsay_lohan/lindsay_lohan.php">Lindsay Lohan&nbsp;&nbsp;&nbsp;&nbsp;</a>
       </div>  
    
     
       <div class="td">
           <a href="../angelina_jolie/angelina_jolie.php">Angelina Jolie&nbsp;&nbsp;&nbsp;&nbsp;</a>
       </div>
    
    
       <div class="td"> 
           <a href="../britney_spears/britney_spears.php">Britney Spears&nbsp;&nbsp;&nbsp;&nbsp;</a>
       </div>
    
    
       <div class="td">
           <a href="../christina_aguilera/christina_aguilera.php">Christina Aguilera&nbsp;&nbsp;&nbsp;&nbsp;</a>
       </div>
    
    
       <div class="td">  
           <a href="../jessica_alba/jessica_alba.php">Jessica Alba&nbsp;&nbsp;&nbsp;&nbsp;</a>
       </div>
    
    
       <div class="td">    
           <a href="../halle_berry/halle_berry.php">Halle Berry&nbsp;&nbsp;&nbsp;&nbsp;</a>
       </div>
    
    //line 97
       <div class="td">
           <a href="../jennifer_aniston/jennifer_aniston.php">Jennifer Aniston&nbsp;&nbsp;&nbsp;&nbsp;</a>
       </div>
    //line 102
    
    
    
    <div class="navadff">
    
    <h5> 
    More than 90% of the Internets pro's prefer Firefox over Internet Explorer!
    What are you using?
    
     <script type="text/javascript"><!--
     google_ad_client = "pub-1666729901034065";
     google_ad_width = 120;
     google_ad_height = 60;
     google_ad_format = "120x60_as_rimg";
     google_cpa_choice = "CAAQueKXhAIaCKrCZAD7Zb_VKI-293M";
     google_ad_channel = "2717679951";
     //--></script>
     <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
     </script>
    </h5>
    </div>
    <br/>
    <div class="navad">
    
     <script type="text/javascript"><!--
     google_ad_client = "pub-1666729901034065";
     google_ad_width = 120;
     google_ad_height = 60;
     google_ad_format = "120x60_as_rimg";
     google_cpa_choice = "CAAQuLSkgwIaCACA992HFv4vKMi84IEB";
     google_ad_channel = "2717679951";
     //--></script>
     <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
     </script>
    
    </div>
    <br/>
    <img
            src="http://www.w3.org/Icons/valid-xhtml10"
            alt="Valid XHTML 1.0 Strict" height="31" width="88" />
    <img style="border:0;width:88px;height:31px"
           src="http://jigsaw.w3.org/css-validator/images/vcss" 
           alt="Valid CSS!">
    
      </div>
    
    <div class="rightad">
     <div class="th">
      HotActress
     </div>
    
    
    <div class="navad125">
    
    <script type="text/javascript"><!--
    google_ad_client = "pub-1666729901034065";
    google_ad_width = 125;
    google_ad_height = 125;
    google_ad_format = "125x125_as_rimg";
    google_cpa_choice = "CAAQqPKkgwIaCDK57e_hEspYKOjKrIMB";
    google_ad_channel = "2717679951";
    //--></script>
    <script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    
    </div>
    <br/>
    
    <div class="navad90">
    
    
    <script type="text/javascript"><!--
    google_ad_client = "pub-1666729901034065";
    google_ad_width = 120;
    google_ad_height = 90;
    google_ad_format = "120x90_0ads_al_s";
    google_ad_channel ="5355642538";
    google_color_border = "7b7bf7";
    google_color_bg = "7b7bf7";
    google_color_link = "FFFFFF";
    google_color_text = "FFFFFF";
    google_color_url = "B3B3B3";
    //--></script>
    <script type="text/javascript"src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    </div>
    
    </div>
    
    
    
    </body>
    </html>
    
    ';
    
    ?>
    PHP:
     
    jumpenjuhosaphat, Jul 29, 2006 IP
  4. jumpenjuhosaphat

    jumpenjuhosaphat Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I guess it marks it for you. I counted it twice, and came up to the same place, how does line 101 show up different here? Am I counting wrong? ******disregard this****** My editor automaticall wraps the lines of code when they extrude off of the screen, so in some cases I was counting a line twice.
     
    jumpenjuhosaphat, Jul 29, 2006 IP
  5. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #5
    In the post, line 101 is missing the escaping of the apostrope in Internet Pro's. That is probably it.

    But, that's pretty bad code. Why would you want to echo all that HTML if you can jumpt out of PHP ?> and then just use plain HTML and go back to PHP <?php when you want to echo a variable?
     
    T0PS3O, Jul 29, 2006 IP
  6. jumpenjuhosaphat

    jumpenjuhosaphat Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I don't know why i didn't think of doing it that way. That makes since. I am just learning how to use PHP, I just started 2 or 3 weeks ago, and this is my first attempt since then. I did another script at first, but it wound up being useless, so I abandoned it and just stuck with XHTML. But now, I'd like my files to be smaller, so I am using php to simplify file implimentation and to reduce the wasted space.
     
    jumpenjuhosaphat, Jul 29, 2006 IP
  7. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Try this instead:

    
    
       <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
          <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
    <head>
     <title><?php echo $title; ?></title>
     <link rel="stylesheet" type="text/css" href="../style.css"/>
     
     <meta name="description" content="<?php echo $description; ?>"/>
     <meta name="keywords"    content="<?php echo $keywords; ?>"/>
    
    </head>
    <body>
    
    <div class="body">
    
    <img src="<?php echo $first . '_' . $last . '_' . $picnum . '.jpg" alt="'  . $picdesc;?>"/>
    
    
    PHP:
    etc.

    Much easier to see in syntax hilighting IDE what's going on.
     
    T0PS3O, Jul 29, 2006 IP
  8. jumpenjuhosaphat

    jumpenjuhosaphat Peon

    Messages:
    229
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Yeah, I can see that. Thanks for doing that for me. That does make it alot easier to read, and probably a lot less prone to errors. Thanks again for all of your help. I really appreciate it.
     
    jumpenjuhosaphat, Jul 29, 2006 IP