I have a MySQL table with the values “name” and link”, and now I try to display this values in a html table.
The table looks like this:
<table>
<tr>
<td width="260px"><a href="<?php echo $link; ?>" target="_blank" title="<?php echo $name; ?>"><?php echo $name; ?></a></td>
<td width="260px"><a href="<?php echo $link; ?>" target="_blank" title="<?php echo $name; ?>"><?php echo $name; ?></a></td>
<td width="260px"><a href="<?php echo $link; ?>" target="_blank" title="<?php echo $name; ?>"><?php echo $name; ?></a></td>
<td width="260px"><a href="<?php echo $link; ?>" target="_blank" title="<?php echo $name; ?>"><?php echo $name; ?></a></td>
</tr>
<tr>
<td>...</td>...
</tr>
</table>
But now, how can say with PHP that after 4 cells (td) a new row (tr) will create? I know that I need a while statement, but I don’t know how.
1 Answer