Hello friends,
I am displaying want to display Comments column. It will display the 1,2,3,4,..n where n is the number of application in proposal_application table.
The code dispaly the other information with 2 different color for alternate rows. Can you please help me out to display the Comments column. Here is the code for it.
for example
Comments
----------------
1
2
3
4
<?php
$color="1";
echo '<table width="100%" align="center" cellpadding="2" cellspacing="0" border="1">';
echo "<tr bgcolor=''>
<td rowspan='2' align='center'><b><font color='#151B8D'>Principal Investigator</td><td rowspan='2' align='center'><b><font color='#151B8D'>Proposal Title</td>
<TD COLSPAN='5' align='center'><b><font color='#151B8D'>Evaluations & Summary</TD><td align='center' rowspan='2'><b><font color='#151B8D'>Comments</td></TR><TD align='center'>
<b><font color='#151B8D'>Reviewer 1</TD><TD align='center'><b><font color='#151B8D'>Reviewer 2</TD><TD align='center'><b><font color='#151B8D'>Reviewer 3</TD>
<TD align='center'><b><font color='#151B8D'>Reviewer 4</TD><TD align='center'><b><font color='#151B8D'>Summary</TD></tr><br>";
$sql = "select * from proposal_application order by student_id";
$result = mysql_query($sql);
while($rows=mysql_fetch_array($result)){
if($color==1)
{
echo "<tr bgcolor='#D3E3E2'>
<td><font size='2' face='Verdana'>".$rows['first_name']." ".$rows['last_name']."</td><td ><font size='2' face='Verdana'>".$rows['title']."</td>";
$s1="select student_id,member_id,total,grade from grade_industry where member_id='20' and student_id='".$rows['student_id']."'";
$re = mysql_query($s1) or die("Query error:" . mysql_error());
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"total");
++$i;
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$grade ($total)</td>";
}
$s1="select student_id,member_id,grade,total from grade_industry where member_id='25' and student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"total");
++$i;
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$grade ($total)</td>";
}
$s1="select student_id,member_id,grade,total from grade_industry where member_id='22' and student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"total");
++$i;
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$grade ($total)</td>";
}
$s1="select student_id,member_id,grade,total from grade_industry where member_id='1' and student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"total");
++$i;
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$grade ($total)</td>";
}
$s2="select count(member_id) from grade_industry where student_id='".$rows['student_id']."'";
$re1 = mysql_query($s2);
$num1=mysql_numrows($re1);
$i=0;
while ($i < $num)
{
//$grade=mysql_result($re,$i,"grade");
$id=mysql_result($re1,$i,"count(member_id)");
$s=$id;
++$i;
}
$s1="select sum(total) from grade_industry where student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
//$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"SUM(total)");
$average=$total/$s;
$a=round($average);
++$i;
}
if($average >= 90)
{
$gra='A';
}
elseif($average >= 85 && $average < 90)
{
$gra='A-';
}
elseif($average >= 80 && $average < 85)
{
$gra='B+';
}
elseif($average >= 75 && $average < 80)
{
$gra='B';
}
elseif($average >= 70 && $average < 75)
{
$gra='B-';
}
elseif($average >= 65 && $average < 70)
{
$gra='C+';
}
elseif($average >= 60 && $average < 65)
{
$gra='C';
}
elseif($average >= 55 && $average < 60)
{
$gra='C-';
}
elseif($average >= 50 && $average < 55)
{
$gra='D+';
}
elseif($average >= 45 && $average < 50)
{
$gra='D+';
}
else
{
$gra='F';
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$gra ($a)</td>";
}
$color="2";
echo "</tr>";
$color="2";
}
// When $color not equal 1, use this table row color
else {
echo "<tr bgcolor='#B7CEEC'>
<td><font size='2' face='Verdana'>".$rows['first_name']." ".$rows['last_name']."</td><td ><font size='2' face='Verdana'>".$rows['title']."</td>";
$s1="select student_id,member_id,grade,total from grade_industry where member_id='20' and student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"total");
++$i;
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$grade ($total)</td>";
}
$s1="select student_id,member_id,grade,total from grade_industry where member_id='25' and student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"total");
++$i;
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$grade ($total)</td>";
}
$s1="select student_id,member_id,grade,total from grade_industry where member_id='22' and student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"total");
++$i;
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$grade ($total)</td>";
}
$s1="select student_id,member_id,grade,total from grade_industry where member_id='1' and student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"total");
++$i;
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$grade ($total)</td>";
}
$s2="select count(member_id) from grade_industry where student_id='".$rows['student_id']."'";
$re1 = mysql_query($s2);
$num1=mysql_numrows($re1);
$i=0;
while ($i < $num)
{
//$grade=mysql_result($re,$i,"grade");
$id=mysql_result($re1,$i,"count(member_id)");
$s=$id;
++$i;
}
$s1="select sum(total) from grade_industry where student_id='".$rows['student_id']."'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
//$grade=mysql_result($re,$i,"grade");
$total=mysql_result($re,$i,"SUM(total)");
$average=$total/$s;
$a=round($average);
++$i;
}
if($average >= 90)
{
$gra='A';
}
elseif($average >= 85 && $average < 90)
{
$gra='A-';
}
elseif($average >= 80 && $average < 85)
{
$gra='B+';
}
elseif($average >= 75 && $average < 80)
{
$gra='B';
}
elseif($average >= 70 && $average < 75)
{
$gra='B-';
}
elseif($average >= 65 && $average < 70)
{
$gra='C+';
}
elseif($average >= 60 && $average < 65)
{
$gra='C';
}
elseif($average >= 55 && $average < 60)
{
$gra='C-';
}
elseif($average >= 50 && $average < 55)
{
$gra='D+';
}
elseif($average >= 45 && $average < 50)
{
$gra='D+';
}
else
{
$gra='F';
}
if ($num == 0)
{
echo "<td align='center'>--</td>";
}
else
{
echo "<td align='center'><font size='2' face='Verdana'>$gra ($a)</td>";
}
// Set $color back to 1
$color="1";
}
}
echo '</table>';
?>