Page 1 of 1

Syntax Error

Posted: Wed Jun 08, 2011 6:56 pm
by unemployment
Why is my syntax off. PHP doesn't return an error.

[syntax=php]$t = '<a href=\"../'.($r['accounttyperaw'] == '') ? 'c' : 'u'.'/'.($r['accounttyperaw'] == '') ? $r['companytag'] : $r['feedusername'].'\">'.ucwords($r['feedfirstname'].' '.$r['feedlastname']).' has updated</a>';[/syntax]

Re: Syntax Error

Posted: Wed Jun 08, 2011 7:01 pm
by jacek
unemployment wrote:PHP doesn't return an error.

Then your syntax is probably fine.

What exactly is the problem ?

Re: Syntax Error

Posted: Wed Jun 08, 2011 7:07 pm
by unemployment
jacek wrote:
unemployment wrote:PHP doesn't return an error.

Then your syntax is probably fine.

What exactly is the problem ?


The a tag isn't echoing for some reason

Re: Syntax Error

Posted: Wed Jun 08, 2011 7:09 pm
by bowersbros
um. are you echoing $t? :D

Re: Syntax Error

Posted: Wed Jun 08, 2011 7:23 pm
by unemployment
bowersbros wrote:um. are you echoing $t? :D


Yes... still not working

Re: Syntax Error

Posted: Wed Jun 08, 2011 7:30 pm
by jacek
Can you post the full code ?

Re: Syntax Error

Posted: Wed Jun 08, 2011 7:32 pm
by unemployment
I just made this for testing purposes but I can't get it to work. That's all the code.

[syntax=php]$r['feedusername'] = 1;
$r['feedfirstname'] = 2;
$r['feedlastname'] = 3;
$r['gender'] = 1;

$r['accounttyperaw'] = '';
$r['companytag'] = 'stuff';
$r['feedusername'] = 'test';

$t = '<a href=\"../'.($r['accounttyperaw'] == '') ? 'c' : 'u'.'/'.($r['accounttyperaw'] == '') ? $r['companytag'] : $r['feedusername'].'\">'.ucwords($r['feedfirstname'].' '.$r['feedlastname']).' has updated</a>';[/syntax]

Re: Syntax Error

Posted: Wed Jun 08, 2011 7:40 pm
by EcazS
[syntax=php]echo $t;[/syntax]
???

Re: Syntax Error

Posted: Thu Jun 09, 2011 2:40 am
by unemployment
I figured out the solution to my problem. I needed more parenthesis.

[syntax=php]$t = '<a href="../'.(($r['accounttyperaw'] == '') ? 'c' : 'u').'/'.(($r['accounttyperaw'] == '') ? $r['companytag'] : $r['feedusername']).'">'.ucwords($r['feedfirstname'].' '.$r['feedlastname']).' has updated</a>';[/syntax]