Hello friends,
I am displaying the comments suggested by 4 faculty members for each student. I want displaying three columns. Let me start with the second column first, which displays
the Faculty 1, faculty 2, faculty 3, faculty 4. The third row display respectively comments given by faculty. Ok. Now the first column should display 1,2,3,4...n.
Where n is the total no. of row in proposal table.
IN proposal table i have columns
-student_id
-first_name
-last_name
In grade table i have columns
-student_id
-faculty_id
-comments
For example if there are 3 rows in proposal table than output should be like
1 | faculty 1 | comments by faculty 1
| faculty 2 | comments by faculty 2
| faculty 3 | comments by faculty 3
| faculty 4 | comments by faculty 4
2 | faculty 1 | comments by faculty 1
| faculty 2 | comments by faculty 2
| faculty 3 | comments by faculty 3
| faculty 4 | comments by faculty 4
3 | faculty 1 | comments by faculty 1
| faculty 2 | comments by faculty 2
| faculty 3 | comments by faculty 3
| faculty 4 | comments by faculty 4
RIGHT NOW EVERYTHING IS SHOWING PROPERLY EXCEPT THE FIRST COLUMN. CAN YOU PLZ HELP ME OUT? I AM ATTACHING MY CODE
<h4><u>Comments</h3><br><br>
<?
$sql = "select * from proposal order by student_id";
$result = mysql_query($sql);
$num1=mysql_numrows($result);
while($rows=mysql_fetch_array($result))
{
?>
<table>
<tr>
<td>1</td>
<td><b><font size='2' face='Verdana'>Faculty 1</b></td>
<td><b></td>
<?
$s1="select comments from grade where student_id='".$rows['student_id']."' and faculty_id='20'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$comments=mysql_result($re,$i,"comments");
++$i;
}
if ($comments == '')
{
echo "<td >--</td>";
}
else
{
echo "<td ><font size='2' face='Verdana'>$comments</td>";
}?></tr>
<tr>
<td></td>
<td><b><font size='2' face='Verdana'>Faculty 2</td>
<td><b></td>
<?
$s1="select comments from grade where student_id='".$rows['student_id']."' and faculty_id='25'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$comments=mysql_result($re,$i,"comments");
++$i;
}
if ($comments == '')
{
echo "<td>--</td>";
}
else
{
echo "<td><font size='2' face='Verdana'>$comments</td>";
}?>
</tr><td></td>
<td><b><font size='2' face='Verdana'>Faculty 3</td>
<td><b></td>
<?
$s1="select comments from grade where student_id='".$rows['student_id']."' and faculty_id='22'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$comments=mysql_result($re,$i,"comments");
++$i;
}
if ($comments == '')
{
echo "<td >--</td>";
}
else
{
echo "<td ><font size='2' face='Verdana'>$comments</td>";
}
?></tr><td>4</td>
<td><b><font size='2' face='Verdana'>Faculty 4</td>
<td><b> </td>
<?
$s1="select comments from grade where student_id='".$rows['student_id']."' and faculty_id='1'";
$re = mysql_query($s1);
$num=mysql_numrows($re);
$i=0;
while ($i < $num)
{
$comments=mysql_result($re,$i,"comments");
++$i;
}
if ($comments == '')
{
echo "<td>--</td>";
}
else
{
echo "<td><font size='2' face='Verdana'>$comments</td>";
}?>
</tr>
</table><?}?>