获取表名

cxg65641074 2009-09-23 01:48:36
我不想获取phpadmin中information_schema中的所有表名,只想获取其中一个数据库industry中的表,我应该怎么做
我写的代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>行业数据库 表名管理</title>
<script type="text/javascript">
function add()
{
window.location="creat_tablefield.php"
}
</script>
</head>
<body>
<?php
//连接数据库服务器
$con = mysql_connect("localhost","root","123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
//选择数据库
mysql_select_db("information_schema", $con);
//选择数据表
$result = mysql_query("SELECT table_name FROM tables");
//输出表单
echo "<table width='552' height='180' border='1'>
<tr>
<td height='47' colspan='2'>账户管理>表管理>表名管理</td>
<td width='56'colspan='1' align='center'>
<label>
<input name='button' type='button' value='退出'/>
</label> </td>
</tr>
<tr>
<td colspan='3'>
<label>
<input type='submit' name='Submit1' value='增加' onclick='add()'/>
<input type='submit' name='Submit2' value='删除'/>
<input type='submit' name='Submit3' value='修改字段'/>
<input type='submit' name='Submit4' value='查询'/>
</label>
</td>
</tr>
<tr>
<th>选中</th>
<th>英文表名</th>
<th>表字段详情</th>
</tr>";

while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td><input type='checkbox' name='ischeck'></td>";
echo "<td>" . $row['table_name'] . "</td>";
echo "<td><a href='http://localhost/www/industrydata/zhongsouadmin/detail_tablefield.php?table_name=".$row['table_name']."'>结构</a></td>";
echo "</tr>";
}
echo "</table>";
?>
</body>
</html>
...全文
74 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
zalvsa 2009-09-23
  • 打赏
  • 举报
回复
mysql_query("SELECT table_name FROM tables where table_shema='industry'");
或者在industry下
mysql_query("show tables");

21,886

社区成员

发帖
与我相关
我的任务
社区描述
从PHP安装配置,PHP入门,PHP基础到PHP应用
社区管理员
  • 基础编程社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧