数据怎么多行多列显示
数据怎么多行多列显示 上次发哪个只显示一行这是只显示一行7列的代码
<table width="641" border="0" cellpadding="0" cellspacing="0" bgcolor="#F9F9F9">
<!--DWLayoutTable-->
<?php
$aa="select * from zp";
$result = mysql_query($aa,$Conn); //mysql_query 送出一个查询
$total = mysql_num_rows($result);
$pagesize=7; //我把这个7改成14 就一样显示14个拉 代码不对
if (($total%$pagesize)!=0)
$totalpage=intval($total/$pagesize)+1;
else
$totalpage=intval($total/$pagesize);
if (empty($_GET['pagenum'])){
$_GET['pagenum']=1; }
if($total!=0){
mysql_data_seek($result,(($_GET['pagenum']-1)*$pagesize));
}
$i=1;
while($row=mysql_fetch_array($result)) //mysql_fetch_array 传回数组信息资料
{
?>
<?php if(($a-1)%7==0) { ?> //这个可以控制一行显示7列
<tr>
<?php } ?>
<td width="634" height="80" align="center" valign="middle"><a href="kjj.php?id=<?php echo $row["id"]?>" target="kjj"><img src="<?php echo $row["tp"]?>" width="80" height="80" border="0"></a></td>
<?php if(($a-1)%7==0) { ?>
</tr>
<?php } ?>
<?php
$i++;
if ($i>$pagesize)
break;
else
continue;
}
?>
<tr>
<td width="634" height="30" align="center" valign="middle">
<?PHP
echo "<a href=".$_SERVER['PHP_SELF']."?pagenum=1>首页</a> ";
if ($_GET['pagenum']>1){
$temp_current=$_GET['pagenum']-1;
echo "<a href=".$_SERVER['PHP_SELF']."?pagenum=".$temp_current.">上一页</a> "; }
if ($_GET['pagenum']<$totalpage){
$temp_current=$_GET['pagenum']+1;
echo "<a href=".$_SERVER['PHP_SELF']."?pagenum=".$temp_current.">下一页</a> "; }
echo "<a href=".$_SERVER['PHP_SELF']."?pagenum=".$totalpage.">尾页</a> ";
?>
</td>
</tr>
</table>
[ 本帖最后由 guang2356447 于 2009-10-31 12:07 编辑 ]