Question Locked

PHP T_ELSE error on custom-built, undocumented application

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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 D:\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 D:\members\searchPublicResult.php on line 315"

Anything obvious about this code that is causing it to fail? Thanks for your help!

}

else
{
$pageNav = new mosPageNav(
$total, $limitStart, $limit );
$db->SetQuery($query);

$result = $db->ExecFill();
if($result==NULL ||
count($result)==0)
{

echo "

";
echo "

";
echo "

";
echo "

";
}
else
{
?>

?

No record found

?

?

echo FormatDetailDegree(&$result[0]);
?>


Member Name:?
Name; ?>

Elected:?
YearElected; ?>

Class:?
Class; ?>
? Institution Degree Year
Current Position:?Position; ?>
? ? ? ?
?

}
}
?>

5 replies

by thumbsup2

... 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.

by ccurry

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

by ccurry

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.

if($result != NULL && count($result)!=0)
{
echo "

";
echo "

?

";
echo "

?

";
echo "

?

";
echo "

";
}

?>

This discussion is closed to new replies.