Please help me chack my syntax...

Discussion in 'PHP' started by JSellnau_TSCC, Aug 25, 2010.

  1. #1
    I am working on a script and have run into an error in syntax somewhere because certain information isn't showing up on the page.

      <td valign=\"top\" colspan=\"2\" align=\"center\"><a href=" . $line['photo1'] . "><img src=" . $line['photo1'] . " width=\"150\" height=\"150\"></a>&nbsp;&nbsp;&nbsp;<a href=" . $line['photo2'] . "><img src=" . $line['photo2'] . " width=\"150\" height=\"150\"></a>&nbsp;&nbsp;&nbsp;<a href=" . $line['photo3'] . "><img src=" . $line['photo3'] . " width=\"150\" height=\"150\"></a></td>
    PHP:
    In the code above the 3 "photos" are not displaying on the page. I am somewhat new to this and I don't see where the problem is at the moment. EDIT (I most also note that the code above is being used within an "echo" on a php page.)

    Thank you in advance for your help.
     
    JSellnau_TSCC, Aug 25, 2010 IP
  2. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #2
    <?php
    echo <<<html
    <td valign="top" colspan="2" align="center"><a href="{$line['photo1']}"><img src="{$line['photo1']}" width="150" height="150"></a>&nbsp;&nbsp;&nbsp;<a href="{$line['photo2']}"><img src="{$line['photo2']}" width="150" height="150"></a>&nbsp;&nbsp;&nbsp;<a href="{$line['photo3']}"><img src="{$line['photo3']}" width="150" height="150"></a></td>
    html;
    ?>
    PHP:
     
    danx10, Aug 25, 2010 IP
  3. JSellnau_TSCC

    JSellnau_TSCC Peon

    Messages:
    166
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Using the code in the previous post this is the html code I get on the page...

    <td colspan="2" align="center" valign="top">
    <a href="house5.jpg">
      <img src="house5.jpg" height="150" width="150">
    </a>
    &nbsp;&nbsp;&nbsp;
    <a href="house2.jpg">
      <img src="house2.jpg" height="150" width="150">
    </a>
    &nbsp;&nbsp;&nbsp;
    <a href="house3.jpg">
      <img src="house3.jpg" height="150" width="150">
    </a>
    </td>
    HTML:
    What I need is to have the folder name "photos/" to appear in front of the file name for the picture. Whenever I try to stick the folder name into the code I get a syntax error and I need to know how to properly insert the folder name in front of the file name and maintain correct syntax.
     
    JSellnau_TSCC, Aug 25, 2010 IP
  4. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #4
    <?php
    echo <<<html
    <td valign="top" colspan="2" align="center"><a href="photos/{$line['photo1']}"><img src="photos/{$line['photo1']}" width="150" height="150"></a>&nbsp;&nbsp;&nbsp;<a href="photos/{$line['photo2']}"><img src="photos/{$line['photo2']}" width="150" height="150"></a>&nbsp;&nbsp;&nbsp;<a href="photos/{$line['photo3']}"><img src="photos/{$line['photo3']}" width="150" height="150"></a></td>
    html;
    ?>
    PHP:
     
    danx10, Aug 25, 2010 IP
  5. JSellnau_TSCC

    JSellnau_TSCC Peon

    Messages:
    166
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #5

    Using your second post the "photos" added in the code...
    That seemed to solve the problem.... thank you very much.
     
    JSellnau_TSCC, Aug 25, 2010 IP