By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,077 Members | 1,237 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,077 IT Pros & Developers. It's quick & easy.

problem in syntax

P: 2
Hi,

i used the below sentence

echo "<td><a href=<?=$row['designer_number']?>>".$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/abstractgamearchive/mockup/designers.php on line 169

what's the mistake in that.Plz tell that.
Apr 21 '08 #1
Share this Question
Share on Google+
5 Replies


Markus
Expert 5K+
P: 6,050
Hi,

i used the below sentence

echo "<td><a href=<?=$row['designer_number']?>>".$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/abstractgamearchive/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_number']}>{$row['first_name']}</a></td>";
[/php]
Apr 21 '08 #2

TheServant
Expert 100+
P: 1,168
And use <?php instead of just <?
<? can be used for XHTML and will be depreciated in the next php version I have heard.
Apr 21 '08 #3

Markus
Expert 5K+
P: 6,050
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?
Apr 21 '08 #4

ronverdonk
Expert 2.5K+
P: 4,258
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
Apr 21 '08 #5

TheServant
Expert 100+
P: 1,168
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!
Apr 22 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.