在我的while循环中创建4列

时间:2014-10-14 18:12:29

标签: php

下面是我的while循环表,目前它每行只显示一个项目。我似乎无法弄清楚如何在下面显示新行之前显示4个项目/列。非常感谢您对此的任何帮助,谢谢!

杰罗姆

<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 个答案:

答案 0 :(得分:0)

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>