Jump to content

output in different table columns...


Xiode

Recommended Posts

assuming you have a database...

[code]
<?
$result=mysql_query("SELECT * FROM table");
$i=0;
echo '<table>';
while($row=mysql_fetch_array($result)){
if($i==0) echo '<tr>';
echo ' <td>'.$row[row1].'</td>';
echo ' <td>'.$row[row2].'</td>';
echo ' <td>'.$row[row3].'</td>';
$i++;
if($i==3){
  $i=0;
  echo '<tr>';
}
}
echo '</table>';
?>
[/code]
something to that effect :-)
Maybe I am not seeing this in the code..........

I am pulling some things from the DB.. each row will have it's own box.. I want 3 boxes to go across the page then start a new tr....

Something like this

<tr>
  <td> DB ROW 1 </td>
  <td> DB ROW 2 </td>
  <td> DB ROW 3 </td>
</tr>
<tr>
  <td> DB ROW 4 </td>
  <td> DB ROW 5 </td>
  <td> DB ROW 6 </td>
</tr>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.