Page 1 of 1

Parse error

Posted: Thu May 21, 2009 5:45 am
by jd57
Hi
I'm getting the following error, can someone help?

Parse error: syntax error, unexpected T_STRING, expecting '('

Code: Select all

<img src=<? if (trim($result['approve']) == "TRUE" ) {
if file_exists("http://www.imysite.org/SEArchive/". substr(ucwords(trim($result['Bloom_Name'])),0,1)."/".$result['Bloom_Name']."jpg"){
echo "http://www.mysite.org/SEArchive/". substr(ucwords(trim($result['Bloom_Name'])),0,1)."/".$result['Bloom_Name']."jpg");
} else {
echo "http://www.imysite.org/SEArchive/N/NBA.jpe";

Re: Parse error

Posted: Thu May 21, 2009 5:59 am
by jaoudestudios
You are making it more difficult by squishing all the code onto single lines. Dont be scared to create variables and use them! Nesting multiple functions is not cool nor great for when you come back and edit the code in the future.

At a glance, I guess your problem is probably here...

Code: Select all

if file_exists("http:...
Try...

Code: Select all

if ( file_exists("http:... )

Re: Parse error

Posted: Thu May 21, 2009 6:10 am
by jd57
That'd not it :cry:

Re: Parse error

Posted: Thu May 21, 2009 6:14 am
by jaoudestudios
I suggest clean up your code and make it more readable. You will probably notice your mistake then, if not post it back here in its new cleaned up state and we will be able to spot it (mention which line the error is occuring on)