problem in syntax

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sravani2
    New Member
    • Apr 2008
    • 2

    problem in syntax

    Hi,

    i used the below sentence

    echo "<td><a href=<?=$row['designer_numbe r']?>>".$row['first_name']."</a></td>";

    In that i got the error:
    Parse error: syntax error, unexpected T_ENCAPSED_AND_ WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/local/etc/httpd/sites/tanbo.com/abstractgamearc hive/mockup/designers.php on line 169

    what's the mistake in that.Plz tell that.
  • Markus
    Recognized Expert Expert
    • Jun 2007
    • 6092

    #2
    Originally posted by sravani2
    Hi,

    i used the below sentence

    echo "<td><a href=<?=$row['designer_numbe r']?>>".$row['first_name']."</a></td>";

    In that i got the error:
    Parse error: syntax error, unexpected T_ENCAPSED_AND_ WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /usr/local/etc/httpd/sites/tanbo.com/abstractgamearc hive/mockup/designers.php on line 169

    what's the mistake in that.Plz tell that.
    Youre trying to execute php inside php.
    Change it to:
    [php]
    echo "<td><a href={$row['designer_numbe r']}>{$row['first_name']}</a></td>";
    [/php]

    Comment

    • TheServant
      Recognized Expert Top Contributor
      • Feb 2008
      • 1168

      #3
      And use <?php instead of just <?
      <? can be used for XHTML and will be depreciated in the next php version I have heard.

      Comment

      • Markus
        Recognized Expert Expert
        • Jun 2007
        • 6092

        #4
        Originally posted by TheServant
        And use <?php instead of just <?
        <? can be used for XHTML and will be depreciated in the next php version I have heard.
        Interesting - where have you heard this?

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Anyway, to be deprecated or not, it is very dangerous to use the short-hand tag of php (<?), because you never know whether the server, at which your script eventually is going to run on, has this short-hand option (short_open_tag ) enabled.

          So I would always advise to use the full directive, e.g. <?php.

          This directive also affects the shorthand <?= , which is identical to <? echo . Use of this shortcut also requires short_open_tag to be on.

          Ronald

          Comment

          • TheServant
            Recognized Expert Top Contributor
            • Feb 2008
            • 1168

            #6
            Originally posted by markusn00b
            Interesting - where have you heard this?
            Just checked it again and turned out they aren't doing that anymore. Th plan was to: Remove support for <?, <% and <script language="PHP"> and add "<?php =$var?>" but it looks like they are only going to get rid of <% which noone uses anyway.

            Thanks for asking, I wouldn't have looked for ages if you hadn't!

            Comment

            Working...