获取数据
我已在一张表中将其中的数据获取出来,作为列名,再从另一张表中获取数据与已经取得的列名相对应,我该怎么做?我用的是php+mysql.代码如下:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>行业数据库 表字段管理</title>
<script type="text/javascript">
function quit()
{
window.location="management_tablename.php"
}
</script>
</head>
<body>
<?php
//连接数据库服务器
$con = mysql_connect("localhost","root","123");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
//选择数据库
$db_selected = mysql_select_db("industry",$con);
//执行字符集
mysql_query("set names GBK");
if($_GET)
{
$table_chinesename=$_GET['table_chinesename'];
//选择数据表
$result = mysql_query("SELECT * FROM tablestruct WHERE `table_chinesename` = '$table_chinesename'");
//输出表单
echo "<table width='713' height='88' border='1'>
<tr>
<td height='41' colspan='100%'>账户管理>表管理>表名管理>表数据管理</td>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<td>" . $row['field_chinesename'] . "</td>";
}
echo "</table>";
}
?>
</body>
</html>