【php开源代码栏目提醒】:网学会员为需要php开源代码的朋友们搜集整理了EX02-01.php相关资料,希望对各位网友有所帮助!
<html>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<head>
<title>Apache、
PHP、MySQL 整体测试</title>
</head>
<body bgcolor="white">
<script language = "php">
$dbuser = 'root';
$dbhost = 'hippo.digipress.com';
$dbpass = 'pass
word';
$dbname = 'test2';
$dbtable = 'books';
/* ------ 数据库连结 -------- */
$mysql_link = mysql_connect($dbhost,$dbuser,$dbpass);
$column = mysql_list_fields($dbname,$dbtable,$mysql_link);
$sql = "SELECT * FROM $dbtable";
$result =
mysql_db_query($dbname,$
sql);
</script>
<table bgcolor="black">
<tr><td>
<table>
<script language = "php">
while($value = mysql_fetch_array($result))
{
print "<tr BGCOLOR=YELLOW>";
for($i=0; $i< mysql_num_fields($column); $i++ )
{
print "<td> $value[$i] </td>";
}
print "</tr>";
}
mysql_free_result($result);
mysql_close();
</script>
</table>
</td></tr>
</table>
</body>
</html>