UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

> IF Else Statement error    
 
   
damonpc
post Dec 16 2009, 06:48 PM
Post #1

UtterAccess Addict
Posts: 141
From: Launceston, Tasmania



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
Go to the top of the page
 
+
 
Start new topic
Replies (1 - 1)
DougY
post Dec 16 2009, 10:51 PM
Post #2

Utterly Abby-Normal
Posts: 9,781
From: Seattle, WA [USA]



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>
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 18th June 2013 - 10:35 PM