我目前正在进行显示数据页面。我的表没有从数据库中检索数据,我的结束标记</table>
无法识别......
<?php
$server = 'localhost';
$user = 'root';
$pass = '';
$db = 'testing';
// Connect to server and select databse.
mysql_connect("$server", "$user", "$pass")or die("cannot connect");
mysql_select_db("$db")or die("cannot select DB");
// Retrieve data from database
$result = mysql_query("SELECT * FROM users_sched ORDER BY term DESC;") or die(mysql_error());
?>
<table width="400" border="1" cellspacing="0" cellpadding="3">
<?php
// Start looping rows in mysql database.
while($row = mysql_fetch_array( $result )) {
?>
<tr>
<td width="20%"> <? echo $rows['subj_code']; ?> </td>
<td width="30%"> <? echo $rows['subj_desc']; ?> </td>
<td width="20%"> <? echo $rows['average']; ?> </td>
<td width="20%"> <? echo $rows['status']; ?> </td>
</tr>
<?php
// close while loop
}
</table>
?>
答案 0 :(得分:0)
<?php
// close while loop
}
?>
</table>
答案 1 :(得分:0)
修正:
<?php
// close while loop
}
?>
</table>
编辑:
并将$ rows数组更改为$ row
从:$rows['subj_code'];
到此:$row['subj_code'];