...

View Full Version : error below appears in the line 1502, where may be the problem ?



lse123
03-03-2009, 07:35 PM
error below appears in the line 1502, where may be the problem ? appear when add $a2 & $_SESSION['a2'], where are the same values, and get values from a form(dynamically appear a2 textbox when a select box is in selectedIndex=3)...

line 1502:
<td>&nbsp;<?php echo date("H:i l F dS, Y", $dated); ?>&nbsp; to &nbsp;<?php (isset($_SESSION['a2'])) ? echo "$Locationd ($a2)" : echo "$Locationd"; ?></td>



Parse error: syntax error, unexpected T_ECHO in /home/content/p/o/l/polisch123/html/quote/quote1a-acc-comments.php on line 1502

Fou-Lu
03-03-2009, 07:38 PM
I don't believe that ternary operators will take execution commands. Thats this part here: echo "$Locationd ($a2)" : echo "$Locationd
So, change it like so:


<td>&nbsp;<?php echo date("H:i l F dS, Y", $dated); ?>&nbsp; to &nbsp;<?php echo (isset($_SESSION['a2'])) ? "$Locationd ($a2)" : "$Locationd"; ?></td>

lse123
03-03-2009, 09:29 PM
error disappears but nothing printed on screen , well ?

Fumigator
03-03-2009, 09:50 PM
You forgot to echo :rolleyes:

Fou-Lu
03-03-2009, 10:54 PM
You forgot to echo :rolleyes:

That would also be my assumption. Thats the benefit of a ternary operator, you know that it will return a result unless its a failed resource command (which will generally return null, which equates to else, so will probably still return a result).



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum