Posted by Jim Michaels on 11/18/63 11:43
"Disco Octopus" <discooctopus@yahoo.com> wrote in message
news:kenkjdfz58h8$.yj85d8ygh72.dlg@40tude.net...
> Jim Michaels wrote:
>
>> C:\prj\quiz\withusers>php tareports.php
>> PHP Parse error: syntax error, unexpected T_ELSE in
>> C:\prj\quiz\withusers\tareports.php on line 205
>>
>>
>> this is the section of code.
>>
>> if (isset($row4)) {
>> if (isset($row5)) { //answer given?
>> if ($row4['answer_tag']==$row5['answer_tag']) {
>> ?>
>> <div class=answer>Answer:<br />
>> <?php echo $row4['answer_tag']; ?>. <?php echo $row5['answer']; ?><?php
>> if
>> ($row5['is_img']) { ?><img src="<?php echo getconfigvar("basepath");
>> ?>viewraimg.php?id=<?php echo $row5['answer_id']; ?>" /><?php } ?>
>> </div>
>> <br />
>> <?php
>> $ncorrect++;
>> } else { //no answer or answer is wrong
>
> ----------------^
> ... this char here
>
>
>> ?>
>> <div class=answer>Answer 1:<br />
>> <?php echo $row5['answer_tag']; ?>. <?php echo $row5['answer']; ?><?php
>> if
>> ($row5['is_img']) { ?><img src="<?php echo getconfigvar("basepath");
>> ?>viewraimg.php?id=<?php echo $row5['answer_id']; ?>" /><?php } ?>
>> </div>
>> <div class=answer>Answer 2:<br />
>> <?php echo $row4['answer_tag']; ?>. <?php echo $row4['answer']; ?><?php
>> if
>> ($row4['is_img']) { ?><img src="<?php echo getconfigvar("basepath");
>> ?>viewraimg.php?id=<?php echo $row4['answer_id']; ?>" /><?php } ?>
>> </div>
>> <br />
>> <?php
>> $nwrong++;
>> }
> ---------^
> ... is ended by this one here, therefore an else is not expected here...
>
>> ...else blah blah
>>
>>
>> I need a 2nd pair of eyes. I've gone as far as I can debugging this
>> thing.
>> my braces match. I even eliminated a stray open switch statement that I
>> copied from code elsewhere. Am I running into a PHP parser bug that
>> doesn't
>> like certain IF constructs here?
>>
>> I once got an error message about an unexpected } because one was missing
>> in
>> my code or something like that. It was an odd error message for the
>> problem.
>> and I think I am getting another one of these.
>
>
> Just at a glance I found the above.
>
> I use a text editor called Textpad. It allows me to match open/close
> braces/brackets/defined programming block containers. This is how I found
> this.
tried textpad. dreamweaver does the same thing as control-shift-M. Found
the open switch statement by printing out the code and drawing lines between
the brackets. turned out to be mostly dead code so I eliminated it. but it
was farther up the code block. didn't eliminate the error message. all it
did was move it.
the entire file (with headers for execution) can be found for a while at
http://home.comcast.net/~mmediap3/z/dbinc.php
http://home.comcast.net/~mmediap3/z/header.php
http://home.comcast.net/~mmediap3/z/tareports.php
tareports.php is the one with the problem.
[Back to original message]
|