Insert Rows

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
arrowhead
Forum Newbie
Posts: 4
Joined: Wed Mar 25, 2009 5:02 pm

Insert Rows

Post by arrowhead »

Code: Select all

 
<?php
mysql_select_db($database_TL, $team);
$query_Recordset1 = "SELECT * FROM `gs` ";
 
$Recordset1 = mysql_query($query_Recordset1, $team) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
 

Code: Select all

 
<table class="player"> 
  <tr valign="top">
  <?php  
  do {?> 
    <td width="14%"><div class="teamProfilePlayerBox"> 
    <a href="oyuncu.php" class="splash_opacity"><img src="../images/player/gs/thumb/<?php echo $row_Recordset1['formano']; ?>.jpg" height="72" border="0" /></a><br />
      <div class="teamProfileName"><span class="teamProfileNameColor"><?php echo $row_Recordset1['formano'];  ?></span> <?php echo $row_Recordset1['name']; ?></div>
    </div></td>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> 
  </tr>   
</table>
 
Result:
Image

What do i need to do to have only 3 data (player information) on every row?:
<table>
<tr>
<td>data</td> <td>data</td> <td>data</td></tr>
<tr>
<td>data</td> <td>data</td> <td>data</td></tr>
</table>
sujithtomy
Forum Commoner
Posts: 46
Joined: Tue Mar 24, 2009 4:43 am

Re: Insert Rows

Post by sujithtomy »

Hello,

try this,

Code: Select all

<table class="player">
  <tr valign="top">
  <?php  $x = 1;
  do { if($x > 3){ echo "<tr>"; $x = 1; } ?>
    <td width="14%"><div class="teamProfilePlayerBox">
    <a href="oyuncu.php" class="splash_opacity"><img src="../images/player/gs/thumb/<?php echo $row_Recordset1['formano']; ?>.jpg" height="72" border="0" /></a><br />
      <div class="teamProfileName"><span class="teamProfileNameColor"><?php echo $row_Recordset1['formano'];  ?></span> <?php echo $row_Recordset1['name']; ?></div>
    </div></td>
  <?php if($x == 3){ echo "</tr>"; } $x++;  } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?> 
</table>
 
Good Luck :)
Post Reply