<?php
header("content-type:text/html;charset=utf-8");
$conn=mysql_connect('localhost','root','root') or die('数据库连接失败!');
mysql_select_db('student');
mysql_query('set names utf8');
$rs=mysql_query("select * from stu_grade");
echo "<table width='900' border='1' bordercolor='blue'>";
echo "<tr>";
echo "<th>ID</th>";
echo "<th>姓名</th>";
echo "<th>分数</th>";
echo "</tr>";
while ($row=mysql_fetch_row($rs)) {
echo "<tr>";
echo "<td>{$row[0]}<td>";
echo "<td>{$row[1]}<td>";
echo "<td>{$row[2]}<td>";
echo "</tr>";
}
echo "</table>";
?>
1 回答
慕姐4208626
TA贡献1852条经验 获得超7个赞
echo "<tr>";
echo "<td>{$row[0]}</td>";
echo "<td>{$row[1]}</td>";
echo "<td>{$row[2]}</td>";
echo "</tr>";
改成这样.
建议直接学习mysqli或者pdo,
- 1 回答
- 0 关注
- 442 浏览
添加回答
举报
0/150
提交
取消