[原创]老大们,我又有问题了,循环的问题,先谢过了!!!! |
<?php require_once('Connections/connmyguding.php'); ?>
<?php
mysql_select_db($database_connmyguding, $connmyguding);
$query_Recordset1 = "SELECT * FROM `user`";
$Recordset1 = mysql_query($query_Recordset1, $connmyguding) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
<style type="text/css">
<!--
.style1 {
font-size: 30px;
font-weight: bold;
font-family: "华文隶书";
}
.style2 {
font-family: "楷体_GB2312";
font-size: 14px;
}
.style3 {font-size: 14px}
.style5 {font-size: 14px; font-weight: bold; }
.style7 {font-family: "楷体_GB2312"; font-size: 14px; font-weight: bold; }
-->
</style>
</head>
<body>
<?php
for($i=0;$i<$totalRows_Recordset1;$i++)
{
echo "<table width='621' height='428' border='0' cellpadding='0' cellspacing='0'>";
echo "<tr>";
echo "<td width='621' height='64'><div align='center'><span class='style1'>固定资产验收单</span></div></td>";
echo "</tr>";
echo "<tr>";
echo "<td height='41'><span class='style7'>J技-10</span></td>";
echo "</tr>";
echo "<tr>";
echo "<td height='244'><table width='621' border='2' cellpadding='0' cellspacing='0' bordercolor='fda316' style='border-collapse: collapse;'>";
echo "<tr>";
echo "<td width='64' height='40'><div align='center'><span class='style5'>设备编号</span></div></td>";
echo "<td width='106' height='40'><div align='center'>".$row_Recordset1['user_id']."</div></td>";echo "<td width='49'><div align='center'><span class='style5'>类 别</span></div></td>";
echo "<td width='73'><div align='center'>设备编号</div></td>";
echo "<td width='69'><div align='center'><span class='style5'>子类别1</span></div></td>";
echo "<td width='81'><div align='center'>设备编号</div></td>";
echo "<td width='69'><div align='center'><span class='style5'>子类别2</span></div></td>";
echo "<td width='92'><div align='center'>设备编号</div></td>";
echo "</tr>";
echo "<tr>";
echo "<td height='200'><div align='center'><span class='style5'>财务部门</span></div>";
echo "<div align='center'></div></td>";
echo "<td colspan='3' valign='bottom'><div align='right'><strong><span class='style3'>年 月 日</span></strong></div></td>";
echo "<td><div align='center'><span class='style5'>财务科</span></div>";
echo "<div align='center'><span class='style3'></span></div></td>";
echo "<td colspan='3' valign='bottom'><div align='right'><strong><span class='style3'>年 月 日</span></strong></div></td>";
echo "</tr>";
echo "</table></td>";
echo "</tr>";
echo "<tr>";
echo "</tr>";
echo "</table>";
}
?>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
——————————————————————————
这么个东西呢,运行的话,会出现和记录数相同多的表,比如说,有10条记录吧,那么就会有10个表,而我希望的是在echo "<td width='106' height='40'><div align='center'>".$row_Recordset1['user_id']."</div></td>"这一行里,分别显示出十条记录不同的'user_id',比如说,在第一个表显示第一条记录的user_id,第二个表显示第二条记录的user_id,我该怎么写这个循环呢? |
|
|