【php开源代码栏目提醒】:本文主要为网学会员提供9-1.php,希望对需要9-1.php网友有所帮助,学习一下!
<?
$link = mysql_connect("localhost","root","123456");
//联机
mysql_query("use mysql");
//选择数据库
$result = my
sql_query("select * from user",$link);
//下 SQL 指令
/* 以
HTML Table 方式解析返回数据 */
echo "<table border=1>\n";
echo "<tr>\n";
/* 打印表头 */
while ($field =
mysql_fetch_field($result)) {
echo "<td>".$field->name."</td>\n";
}
echo "</tr>\n";
/* 打印表身 */
while ($row = mysql_fetch_row($result)) {
echo "<tr>\n";
for($i=0;$i<count($row);$i++){
echo "<td>".$row[$i]."</td>";
}
echo "</tr>\n";
}
echo "</table>\n";
/* 释放 result */
mysql_free_result($result);
/* 关闭连结 */
mysql_close($link);
?>