Question

Locked

PHP T_ELSE error on custom-built, undocumented application

By ccurry ·
Hello all,

The php below is generating errors when executed. The code below starts at line 313; it generates the following error:
"PHP Parse error: syntax error, unexpected '}' in \members\searchPublicResult.php on line 314"
When I remove the offending '{' character, the following error (which confounds me) surfaces:
"PHP Parse error: syntax error, unexpected T_ELSE in \members\searchPublicResult.php on line 315"

Anything obvious about this code that is causing it to fail? Thanks for your help!
<br/><br/>
<?php<br/>
}<br/>
else<br/>
{<br/>
$pageNav = new mosPageNav(<br/> $total, $limitStart, $limit );<br/>
$db->SetQuery($query);<br/>

$result = $db->ExecFill();<br/>
if($result==NULL ||<br/> count($result)==0)<br/>
{<br/>
echo "<table align='center' cellpadding='0' cellspacing='0' border='0' class='contentcell2' width='95%'>";
echo "<td width='20'><br><br>?</td>";<br/>
echo "<td align='center'>No record found</td>";<br/>
echo "<td width='20'><br><br>?</td>";<br/>
}<br/>
else<br/>
{<br/>
?><br/>
<table align="center" cellpadding="0" cellspacing="0" border="0" class="contentcell2" width="95%"><br/>
<tr><br/>
<td width='20'><br>?</td><br/>
<td><br/>
<table cellpadding='2' cellspacing='0' border='0' width='100%' class='contentcell4'><br/>
<tr><br/>
<td width='20%' colspan="2"><font face='Times New Roman'><b><br>Member Name</b><?php echo $result[0]->Name; ?></font></td><br/>
<td width='20%'><font face='Times New Roman'><b><br>Elected</b><?php echo $result[0]->YearElected; ?> </font></td><br/>
<td width='20%'><font face='Times New Roman'><b><br>Class</b><?php echo $result[0]->Class; ?> </font></td><br/>

</tr><br/>
<tr><br/>
<td width='25%'><br>?</td><br/>
<td width='25%'><br><b><font face='Times New Roman'>Institution</font></b></td><br/>
<td width='25%'><br><b><font face='Times New Roman'>Degree</font></b></td><br/>
<td width='25%'><br><b><font face='Times New Roman'>Year</font></b></td><br/>
</tr><br/>
<?php<br/>
echo FormatDetailDegree(&$result[0]);<br/>
?><br/>
<tr><br/>
<td colspan="4"><br><b>Current Position</b><?php echo $result[0]->Position; ?><br/>
</td><br/>
</tr><br/>
<tr><br/>
<td width='25%'>?</td><br/>
<td width='25%'>?</td><br/>
<td width='25%'>?</td><br/>
<td width='25%'>?</td><br/>
</tr><br/>
</table><br/>
</td><br/>
<td width='20'><br>?</td><br/>
</tr><br/>
</table><br/>
<?php<br/>
}<br/>
}<br/>
?><br/>

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

The original error indicates...

by ThumbsUp2 In reply to PHP T_ELSE error on custo ...

... the first '}' before the ELSE is unexpected. That means you've already closed the statement somewhere prior to the <?PHP, so check your nesting.

HINT: Use indentation to check your nesting.

You also said when you "remove the offending '{' character", you get another error. You're removing the wrong bracket.

Collapse -

Thanks

by ccurry In reply to The original error indica ...

Thanks for the lightning fast reply. You are exactly right.

Collapse -

oops, nevermind

by ccurry In reply to PHP T_ELSE error on custo ...

I just realized that the "if" statement that is supposed to precede this statement prematurely ended (code below ends on line 313): I was deleting the wrong bracket. Fixed.
<br /><br />
<?php<br />
if($result != NULL && count($result)!=0)<br />
{<br />
echo "<tr>";<br />
echo "<td width='20'>?</td>";<br />
echo "<td align='center'>?</td>";<br />
echo "<td width='20'>?</td>";<br />
echo "</tr>";<br />
<b>}</b><br />
?><br />
</table><br />
<?php<br />

Collapse -

Yep, that'll do it! <nt>

by ThumbsUp2 In reply to oops, nevermind
Back to Software Forum
4 total posts (Page 1 of 1)  

Related Discussions

Related Forums