-1

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>
Jump_Ace
  • 193
  • 1
  • 3
  • 11
  • 4
    Your syntax is horrendous- missing semicolons, mixed use of long and short PHP tags, weird usage of opening/closing tags multiple times on same line, etc. Start with fixing that stuff first. Make your code easier to read and people will be more willing to help you with it. – Mike Brant Oct 14 '14 at 18:15
  • Please, [don't use `mysql_*` functions](http://stackoverflow.com/questions/12859942/why-shouldnt-i-use-mysql-functions-in-php), They are no longer maintained and are [officially deprecated](https://wiki.php.net/rfc/mysql_deprecation). Learn about [prepared statements](http://en.wikipedia.org/wiki/Prepared_statement) instead, and use [PDO](http://us1.php.net/pdo) or [MySQLi](http://us1.php.net/mysqli). [This article](http://php.net/manual/en/mysqlinfo.api.choosing.php) will help you decide. – Jay Blanchard Oct 14 '14 at 18:16
  • creates a new column. So, make sure that you iterate around new columns, not just new rows. – mansilladev Oct 14 '14 at 18:19

1 Answers1

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>
Hara Prasad
  • 704
  • 6
  • 15