Reply to Re: unexpected ELSE - interpreter bug?

Your name:

Reply:


Posted by Simon on 11/18/55 11:43

>
> I have the same kind of construct which didn't get an error at lines
> 134-153.
> if ($row2['ra_id_given_id']!=0) {
> $q3=mysql_query("SELECT * FROM quiz_report_questions WHERE
> rq_id=$row2[ra_id_given_id]", $link);
> $row3=mysql_fetch_array($q3);
> if ($row2['correct_ra_id']!=0) {
> $q4=mysql_query("SELECT * FROM quiz_report_answers WHERE
> ra_id=$row2[correct_ra_id]", $link);
> $row4=mysql_fetch_array($q4);
> if ($row4['answer_tag']==$row3['answer_tag']) {
> $ncorrect++;
> } else {
> $nwrong++;
> }
> } else { //bad test
> $bad=true;
> }
> } else { // user gave no answer. doesn't matter if no answer
> available.
> if ($row2['correct_ra_id']!=0) {
> //answer available. consider it wrong. don't even have to look
> it up.
> $nwrong++;
> }
> }
> }
>

You have already been told by Disco Octopus what the problem is, (did you
even read his reply?).
Look at the code bellow and it will show you where the error is.

if ($row2['ra_id_given_id']!=0)
{
$q3=mysql_query("SELECT * FROM quiz_report_questions WHERE
rq_id=$row2[ra_id_given_id]", $link);
$row3=mysql_fetch_array($q3);
if ($row2['correct_ra_id']!=0)
{
$q4=mysql_query("SELECT * FROM quiz_report_answers WHERE
ra_id=$row2[correct_ra_id]", $link);
$row4=mysql_fetch_array($q4);
if ($row4['answer_tag']==$row3['answer_tag'])
{
$ncorrect++;
}
else
{
$nwrong++;
}
}
else
{ //bad test
$bad=true;
}
////////////////////////////////////////////////////
// this else has no if!!!!
////////////////////////////////////////////////////
}
else
{ // user gave no answer. doesn't matter if no answer available.
if ($row2['correct_ra_id']!=0)
{
//answer available. consider it wrong. don't even have to look
it up.
$nwrong++;
}
}
}

And in my experience, "(?!?interpreter bug?)" usually means that you are
wrong.

Simon
--
http://urlkick.com/
Free URL redirection service. Turns a long URL into a much shorter one.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация