我想顯示StudentNo,SubjectCode,SubjectDescription和成績,但是當學生失敗時,它會爲所有字段生成另一個條目,所以我想要顯示studentNo,SubjectCode和SubjectDescription一次,同時顯示2個成績該學生.. 例的特定主題: 如何查看字段的雙重輸入並僅顯示其他字段的一個輸入項?
我希望僅顯示這樣的:( 07-08-061 EN110 5/1) 這裏是我的代碼:
**
mysql_select_db($database_strawman, $strawman);
$query_Recordset1 = "SELECT curriculum.SCode, curriculum.SDesc, grade.Grade, students.StudNo FROM students INNER JOIN (curriculum INNER JOIN grade ON curriculum.SCode = grade.GSCode) ON students.StudNo = grade.GStudNo GROUP BY StudNo";
$Recordset1 = mysql_query($query_Recordset1, $strawman) or die(mysql_error());
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<table width="200" border="1">
<tr>
<td>Subject Code</td>
<td>Subject Description</td>
<td>Grade</td>
<td>Student Number</td>
</tr>
<?php while($row_Recordset1 = mysql_fetch_assoc($Recordset1)){ ?>
<tr>
<td><?php echo $row_Recordset1['SCode']; ?></td>
<td><?php echo $row_Recordset1['SDesc']; ?></td>
<td><?php echo $row_Recordset1['Grade']; ?></td>
<td><?php echo $row_Recordset1['StudNo']; ?></td>
</tr>
<?php } ?>
</table> </p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
**
現在看來,這會只顯示大於1的等級。但也想打印出通過等級的失敗等級..所以輸出將是一個科目的2個等級.. – PiDO 2011-02-08 15:46:52