The purpose of this code is to extract info from my database and wrap the results in XML tags.
What i am trying to do is return a "1" or "0" depending on whether the "parent4_cat" = "Commercial".
This works fine:
$xml_file.="\t\t" . "<VARIANT>".htmlspecialchars($product['parent4_cat'])."</VARIANT>\n";which would give an output of:
<VARIANT>Petrol</VARIANT>
This gives me the Parse error: syntax error, unexpected T_IF
$xml_file.="\t\t" . "<COMMERCIAL>".htmlspecialchars.if($product['parent4_cat'] = "Commercial"){ "0";}else{"1";};."</COMMERCIAL>\n";which i want to output:
<COMMERCIAL>1</COMMERCIAL> (or <COMMERCIAL>0</COMMERCIAL>)
I hope this makes sense. Any help would be appreciated.
Kind regards,
Will.