【php开源代码栏目提醒】:网学会员为广大网友收集整理了,filename.php,希望对大家有所帮助!
<html>
<head>
<title>mysql_list_dbs函数</title>
</head>
<body>
<?php
//连接服务器
$connect=mysql_connect("localhost","root", "123456");
//选择数据库
$dbname = "studyphp";
//执行选择数据库操作
mysql_select_db($dbname, $connect)
or die("没有选择数据库 $dbname: " . my
sql_error());
//定义要
查询的表
$res =
mysql_query("select * from price", $connect);
echo "price表中存在的字段有:<br>";
//显示表中的每个字段
echo mysql_field_name($res, 0) . "<br>";
echo mysql_field_name($res, 1) . "<br>";
echo mysql_field_name($res, 2) ;
?>
</body>
</html>