Syntax Error

Ask about a PHP problem here.
Post Reply
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Syntax Error

Post 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]
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Syntax Error

Post by jacek »

unemployment wrote:PHP doesn't return an error.

Then your syntax is probably fine.

What exactly is the problem ?
Image
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Re: Syntax Error

Post 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
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Re: Syntax Error

Post by bowersbros »

um. are you echoing $t? :D
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Re: Syntax Error

Post by unemployment »

bowersbros wrote:um. are you echoing $t? :D


Yes... still not working
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Syntax Error

Post by jacek »

Can you post the full code ?
Image
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Re: Syntax Error

Post 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]
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: Syntax Error

Post by EcazS »

[syntax=php]echo $t;[/syntax]
???
unemployment
Posts: 165
Joined: Fri May 06, 2011 5:02 pm

Re: Syntax Error

Post 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]
Post Reply