Page 1 of 1

Insert Rows

Posted: Mon Mar 30, 2009 6:20 pm
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>

Re: Insert Rows

Posted: Tue Mar 31, 2009 12:28 am
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 :)