- 論壇徽章:
- 0
|
這里完整的代碼如下:
- for($i=0;$i<$dd;$i++) {
- $row = mysql_fetch_array($result);
- /* Get student number of each course */
- //$query = "Select count(*) as stu_num from selected where Course_id='$row[Course_id]'";
- //$query = "Select count(*) as stu_num from selected where Course_id=".$row['Course_id'];
- $query = "Select count(*) as stu_num from selected where Course_id='{$row['Course_id']}'";
- $res = mysql_query($query) or die("Invalid query: " . mysql_error());
- echo $query, "\n", $row['Course_id'], "\n", $stu_num, "\n", "xxx";
- echo "<tr bgcolor=\"#CCFF99\"><td>".$row["Course_id"]."</td><td>".$row["Course_name"]." </td><td>".$row["Teacher_name"]. "</td><td>".$row["Course_time"]."</td><td>".$row["Course_place"]."</td><td>".$row["Credit"]."</td><td>".$stu_num."</td><td><a href=\"delete.php?courseid=".$row["Course_id"]."\">³·Ïû</a></td></tr>";
- }
復(fù)制代碼
我之前也用echo打印了,但是也沒(méi)看出錯(cuò)誤來(lái)呀。
修改過(guò)后在頁(yè)面上打印內(nèi)容如下:
- Select count(*) as stu_num from selected where Course_id='1' 1 xxx
- Select count(*) as stu_num from selected where Course_id='3' 3 xxx
- Select count(*) as stu_num from selected where Course_id='2' 2 xxx
復(fù)制代碼
有點(diǎn)奇怪! |
|