dongnai8013 2014-10-14 18:12
浏览 12

在我的while循环中创建4列

Below is my while loop table, currently it's showing just one item per row. I can't seem to figure out how to get 4 items/columns to show before it shows a new row below. Any help with this would be much appreciated, thank you!

Jerome

<table style="background-color: white">


<?php
                while ($row = mysql_fetch_array($rs)) {
    ?>
 Collapse | Copy Code
<tr <?php //if ($i % 2) echo ' style="background-color: #ECECFB;"';?>>  
<td class="rows"><font color="4D4D4D" size="3"><? echo '<a type="video/x-matroska" href=file://///'.$row["Link"].' target=blank>'.$row["Name"].'</a>' ?><br />
<? echo '<a type="video/x-matroska" href=file://///'.$row["Link"].' target=blank><img src='.$row["Picture"].' height=210px width=141px></a>' ?><br />
<? echo '('.$row["Type"].')' ?>   <? echo $row["Year"] ?>   <? echo $row["Rating"] ?>   <? echo date('H:i', mktime(0,$row["Length"])); ?><br />
<? echo $row["Genre"] ?><br />
<? if ($row["Queue"]==='x') { 
echo 
"<center><a title=Remove From Watch List href='deletequeue.php?id=".$row['ID']."'><img align='center' width='20px' src='http://www.ourlittlelucas.net/ourflix/images/Minus.png'></a></td></font></center>"; 
} 
else { 
echo "<center><a title=Add To Watch List href='addqueue.php?id=".$row['ID']."'><img align='center' width='20px' src='http://www.ourlittlelucas.net/ourflix/images/Plus.png'></a></td></font></center>"; 
}
?>
</td></tr></font>
<?php $i++?>
<?php
}
?>
</table>
  • 写回答

1条回答 默认 最新

  • dongpai2468 2014-10-14 18:28
    关注
    Try it
    <table style="background-color: white">
    
    
    <?php
                    while ($row = mysql_fetch_array($rs))
                    {
        ?>
     Collapse | Copy Code
    <tr <?php //if ($i % 2) echo ' style="background-color: #ECECFB;"';?>>  
    <td class="rows">
    <font color="4D4D4D" size="3"><?php echo '<a type="video/x-matroska" href=file://///'.$row["Link"].' target=blank>'.$row["Name"].'</a>'; ?><br />
    <?php echo '<a type="video/x-matroska" href=file://///'.$row["Link"].' target=blank><img src='.$row["Picture"].' height=210px width=141px></a>'; ?><br />
    <?php echo '('.$row["Type"].')' ?>  
     <?php echo $row["Year"] ;?>   
     <?php echo $row["Rating"]; ?>  
     <?php echo date('H:i', mktime(0,$row["Length"])); ?><br />
    <?php echo $row["Genre"] ;?><br />
    <?php 
    if ($row["Queue"]=="x") { 
    echo 
    "<center><a title=Remove From Watch List href='deletequeue.php?id=".$row['ID']."'><img align='center' width='20px' src='http://www.ourlittlelucas.net/ourflix/images/Minus.png'></a></td></font></center>"; 
    } 
    else
     { 
    echo "<center><a title=Add To Watch List href='addqueue.php?id=".$row['ID']."'><img align='center' width='20px' src='http://www.ourlittlelucas.net/ourflix/images/Plus.png'></a></td></font></center>"; 
    }
    ?>
    </td></tr></font>
    <?php $i++?>
    <?php
    }
    ?>
    </table>
    
    评论

报告相同问题?