unemployment Posted June 8, 2011 Share Posted June 8, 2011 Does this have a syntax error? The link won't echo. All that echoes is the companytag $t = '<a href=\"../'.($r['accounttyperaw'] == '') ? 'c' : 'u'.'/'.($r['accounttyperaw'] == '') ? $r['companytag'] : $r['feedusername'].'\">'.ucwords($r['feedfirstname'].' '.$r['feedlastname']).' has updated</a>'; Quote Link to comment https://forums.phpfreaks.com/topic/238810-i-can-echo-my-a-tag/ Share on other sites More sharing options...
Maq Posted June 8, 2011 Share Posted June 8, 2011 Turn on error reporting. Quote Link to comment https://forums.phpfreaks.com/topic/238810-i-can-echo-my-a-tag/#findComment-1227100 Share on other sites More sharing options...
requinix Posted June 8, 2011 Share Posted June 8, 2011 I bet it's an issue with precedence. I can't even tell what you're trying to do. Add some parentheses, keeping in mind that string concatenation has higher precedence than (=will be processed before) the ternary operator. Quote Link to comment https://forums.phpfreaks.com/topic/238810-i-can-echo-my-a-tag/#findComment-1227104 Share on other sites More sharing options...
ober Posted June 8, 2011 Share Posted June 8, 2011 Call me stupid, but where is the echo? You're setting the value of the comparison to a variable. Is there more to the code? Quote Link to comment https://forums.phpfreaks.com/topic/238810-i-can-echo-my-a-tag/#findComment-1227106 Share on other sites More sharing options...
kenrbnsn Posted June 8, 2011 Share Posted June 8, 2011 Write the string as: <?php $t = '<a href="../'.(($r['accounttyperaw'] == '') ? 'c' : 'u').'/'.(($r['accounttyperaw'] == '') ? $r['companytag'] : $r['feedusername']).'">'.ucwords($r['feedfirstname'].' '.$r['feedlastname']).' has updated</a>'; ?> Ken Quote Link to comment https://forums.phpfreaks.com/topic/238810-i-can-echo-my-a-tag/#findComment-1227109 Share on other sites More sharing options...
unemployment Posted June 9, 2011 Author Share Posted June 9, 2011 Write the string as: <?php $t = '<a href="../'.(($r['accounttyperaw'] == '') ? 'c' : 'u').'/'.(($r['accounttyperaw'] == '') ? $r['companytag'] : $r['feedusername']).'">'.ucwords($r['feedfirstname'].' '.$r['feedlastname']).' has updated</a>'; ?> Ken Thanks for figuring this out Ken. I guess I need extra paranthesis Quote Link to comment https://forums.phpfreaks.com/topic/238810-i-can-echo-my-a-tag/#findComment-1227251 Share on other sites More sharing options...
ryanfilard Posted June 9, 2011 Share Posted June 9, 2011 Try This: <?PHP $t = echo '<a href=\"../'.($r['accounttyperaw'] == '') ? 'c' : 'u'.'/'.($r['accounttyperaw'] == '') ? $r['companytag'] : $r['feedusername'].'\">'.ucwords($r['feedfirstname'].' '.$r['feedlastname']).' has updated</a>'; ?> Quote Link to comment https://forums.phpfreaks.com/topic/238810-i-can-echo-my-a-tag/#findComment-1227254 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.