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]
Syntax Error
Re: Syntax Error
unemployment wrote:PHP doesn't return an error.
Then your syntax is probably fine.
What exactly is the problem ?
-
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Re: Syntax Error
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
-
- Posts: 534
- Joined: Thu May 05, 2011 8:19 pm
Re: Syntax Error
um. are you echoing $t? ![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
![Very Happy :D](./images/smilies/icon_e_biggrin.gif)
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ![Wink ;)](./images/smilies/icon_e_wink.gif)
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
![Wink ;)](./images/smilies/icon_e_wink.gif)
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
-
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Re: Syntax Error
bowersbros wrote:um. are you echoing $t?
Yes... still not working
-
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Re: Syntax Error
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]
[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
[syntax=php]echo $t;[/syntax]
???
???
-
- Posts: 165
- Joined: Fri May 06, 2011 5:02 pm
Re: Syntax Error
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]
[syntax=php]$t = '<a href="../'.(($r['accounttyperaw'] == '') ? 'c' : 'u').'/'.(($r['accounttyperaw'] == '') ? $r['companytag'] : $r['feedusername']).'">'.ucwords($r['feedfirstname'].' '.$r['feedlastname']).' has updated</a>';[/syntax]