Parse Error help

I’m receiving the following error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/humanity/domains/northtexasexotics.com/public_html/reference.php on line 392

In regards to the code below:

[php]PHP Code:

<?php if ($row_reference['Photo1']==""){ echo ""; }else{ echo ""; }[/php] Any ideas on how I could fix this would be greatly appreciated. I'm totally new to PHP and have been trying to work through each problem one-by-one but this thing has me in knots!

bump :). Can anyone help me with this?

Change this line:
[php]echo “”;[/php]

to:
[php]echo ‘’;[/php]

You are a lifesaver smoky! Any chance you could explain why it needs to be written like that?

Basically, another valid version of your code would have been this:

[php]echo “<img src=“headerimgs/”.$row_reference[‘Photo1’].”">";[/php]

Strings are started and ended by either a pair of double quotes (“string”) or single quotes (‘string’);
This means that your string tries to end when you add the speech mark for the ‘src’ attribute in the img tag. This makes PHP rather confused when you then start typing more of the string and variables, then re-create the string again at the end (">"). You can either use

[php]$string = ‘string with “speech marks”’;
$string = “string with “speech marks””; //note the " (this is called escaping) - this forces PHP to treat the quote as a literal character rather than the start or end of a string
[/php]

I have changed the variable to make use of ‘concatenation’
[php]$variable = “hello”;
$string = “My variable contains the word “.$variable.” !!”; //outputs: My variable contains the word hello !![/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service