Error message: syntax error, unexpected T_STRING, expecting ',' or ';'

Hello,

Can anyone help? i am getting the following error when I try to run my code but I can’t find a missing ; anywhere on line 39.

Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /home/casadeh1/public_html/navigation.php on line 39

This is my code:

<?php $current_file_name=basename($_SERVER['REQUEST_URI'],".php"); if ($current_file_name=="main") { echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; } elseif ($current_file_name=="collections") { echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; } elseif ($current_file_name=="measurements") { echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; echo '
'; } ?>

Hi,

Try escaping all of your ’ characters in your echos. Replace them all with ’ and see if it works.

Hello,

I changed all my ’ characters in the if else section to ‘’ and the file will load without error however, the scroll over image function still does not work. I’m not sure what is wrong with the scroll over function. If i remove the php syntax and run the same code in html (dreamweaver), the scroll over works. Does anyone know what I am missing when i transfer the code over to php?

Hi again,

I think you need to actually make them escaped apostrophes. Otherwise the html may be cutting off the mouseover function because you have put a closing speech mark.

Try the original code, but literally just replace them with ’

Hi Smokey PHP,

It worked! Thank you for your help :D!

No problem, glad to be of assistance.

Sponsor our Newsletter | Privacy Policy | Terms of Service