Hi,
Please anyone tell me how to check whether the code is executed or not.
For example, i'd did the code, while writting the exams in online, my concept is if a student had already attended the question he should not able to write again. So i'd set some images,as not_answered,review_answer,answered. By checking the flag values the images will get changed.
the following is my code. In that i've to set the not_answered image as default. But i cann't. Please tell me wat i did wrong in that.
Code:
$query2="select flag from tablename where id ='$Id' && no ='$no'";
$res=mysql_query($query2);
if(!$res)
{
echo "<a href='newpartshort.php?orderno=$ono&part=$part&qpid=$qpid&board=$board&subject=$subject&StudentId=$StudentId&totalrows=$totalRows1'><img src='img/not_answered.png'></a>";
}
else
{
while($rw = mysql_fetch_array($res)) {
$flag1=$rw['flag'];
/*if($flag==0)
{
echo "<a href='newpartshort.php?orderno=$ono&part=$part&qpid=$qpid&board=$board&subject=$subject&StudentId=$StudentId&totalrows=$totalRows1'><img src='img/not_answered.png'></a>";
}*/
if($flag1==1)
{
echo "<a href='newpartshort.php?orderno=$ono&part=$part&qpid=$qpid&board=$board&subject=$subject&StudentId=$StudentId&totalrows=$totalRows1'><img src='img/review_answer.png'></a>";
}
else if($flag1==2)
{
echo "<a href='newpartshort.php?orderno=$ono&part=$part&qpid=$qpid&board=$board&subject=$subject&StudentId=$StudentId&totalrows=$totalRows1'><img src='img/answered.png'></a>";
}
else
{
echo "<a href='newpartshort.php?orderno=$ono&part=$part&qpid=$qpid&board=$board&subject=$subject&StudentId=$StudentId&totalrows=$totalRows1'><img src='img/not_answered.png'></a>";
}
}}