做出横向重复区域后
如何让他自动换行?
我想让每行显示3条信息
这是我根据网上的方法改的  但是不成功  各位帮我看下 有什么错误  谢谢
<table width="500" border="0" cellspacing="0" cellpadding="0">
              <tr><?php $str=0;?><?php do { ?>
                <td height="105" align="center" valign="top">
                    <table width="180" border="0" cellspacing="0" cellpadding="0" class="zw">
                      <tr>
                        <td height="10" align="center"><?php $str++;?>
                        
                        <a href="class2.php?text=<?php echo urlencode($row_Recordset1['class2'])?>"><img src="../ht/<?php echo $row_Recordset1['tp']; ?>" width="100" height="100" /></a>
                        
                        
                        </td>
                        </tr>
                      <tr>
                        <td height="10" align="center"><?php echo $row_Recordset1['class2']; ?></td><?php if ($str%3==0) echo "<tr>"; ?>
                      </tr>
                    </table>
                    </td><?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
                </tr>
            </table>

解决方案 »

  1.   

    style="background-repeat: repeat-x "
      

  2.   


    <table width="500" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <?php
    $str=0;
    while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)){
    $str++;
    ?>
    <td height="105" align="center" valign="top">
    <table width="180" border="0" cellspacing="0" cellpadding="0" class="zw">
    <tr>
    <td height="10" align="center">
    <a href="class2.php?text=<?php echo urlencode($row_Recordset1['class2'])?>"><img src="../ht/<?php echo $row_Recordset1['tp']; ?>" width="100" height="100" /></a>
    </td>
    </tr>
    <tr>
    <td height="10" align="center"><?php echo $row_Recordset1['class2']; ?></td>
    </tr>
    </table>
    </td>
    <?php
    if ($str%3==0) echo "</tr><tr>";
    }
    ?>
    </tr>
    </table>
      

  3.   

    <table width="500" border="0" cellspacing="0" cellpadding="0">
      <tr><?php $str=0;?><?php do { ?>
      <td height="105" align="center" valign="top">
      <table width="180" border="0" cellspacing="0" cellpadding="0" class="zw">
      <tr>
      <td height="10" align="center"><?php $str++;?>
        
      <a href="class2.php?text=<?php echo urlencode($row_Recordset1['class2'])?>"><img src="../ht/<?php echo $row_Recordset1['tp']; ?>" width="100" height="100" /></a>
        
        
      </td>
      </tr>
      <tr>
      <td height="10" align="center"><?php echo $row_Recordset1['class2']; ?></td><?php if ($str%3==0) echo "<br>"; ?>
      </tr>
      </table>
      </td><?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
      </tr>
      </table>
      

  4.   

    <table width="500" border="1" cellspacing="0" cellpadding="0">
    <tr>
    <?php
    $str=0;
    for($i=0;$i<10;$i++){
    if ($str>0&&$str%3==0) echo "<tr>";
        $str++;
    ?>
        <td height="105" align="center" valign="top">
            <table width="180" border="1" cellspacing="0" cellpadding="0" class="zw">
            <tr>
            <td height="10" align="center">
            a
            </td>
            </tr>
            <tr>
            <td height="10" align="center"><?php echo $i; ?></td>
            </tr>
          </table>
        </td>
    <?php
        if ($str%3==0) echo "</tr>";
    }
    ?>
    </tr>
    </table>2楼会在记录为三的倍数的时候多输出一个<tr></tr>,不过没什么影响