Parse error

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jd57
Forum Newbie
Posts: 13
Joined: Tue Apr 21, 2009 8:04 am

Parse error

Post 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";
Last edited by Benjamin on Thu May 21, 2009 8:42 am, edited 1 time in total.
Reason: Changed code type from text to php.
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Parse error

Post 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:... )
jd57
Forum Newbie
Posts: 13
Joined: Tue Apr 21, 2009 8:04 am

Re: Parse error

Post by jd57 »

That'd not it :cry:
User avatar
jaoudestudios
DevNet Resident
Posts: 1483
Joined: Wed Jun 18, 2008 8:32 am
Location: Surrey

Re: Parse error

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