Full Version: IF Else Statement error
UtterAccess Discussion Forums > And More... > PHP, Perl, MySQL and Postgres
damonpc
Please could someone look at the code associated with this error
Parse error: syntax error, unexpected T_ELSE, expecting ',' or ';' ...

The code works with just the 'if' statment but fails with the above error when i add the 'else' component.

Code
<td width="13%"><p>
<?php
if ($row_rs_All['Fax']=="") echo "None"
else
echo $row_rs_All['Fax'};
?></p>
</td>

New to PHP but have searched extensively and cannot find the error.

Thanks in anticipation
Damon
DougY
Hi Damon,

I'm not a PHP programmer... but from what I saw in various code snippets you are missing {} (you had an orphan } after the FAX... and an orphan [ before it)

try (not tested):

CODE
<td width="13%"><p>
<?php
if ($row_rs_All['Fax']=="")
{
    echo "None"
}
else
{
    echo $row_rs_All['Fax']
}
?></p>
</td>
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.