Repeat after 2 entries
Posted: Wed Apr 20, 2005 6:52 pm
Im using this piece of code to read from the database and show the information. However at the moment it shows it as:Now i wanted to know how can i make it so it uses the </tr> tag every 2 results? So it shows this:
Code: Select all
<tr>
<td>ENTRY</td>
</tr>
<tr>
<td>ENTRY</td>
</tr>
<tr>
<td>ENTRY</td>
</tr>
<tr>
<td>ENTRY</td>
</tr>Code: Select all
<tr>
<td>ENTRY</td>
<td>ENTRY</td>
</tr>
<tr>
<td>ENTRY</td>
<td>ENTRY</td>
</tr>Code: Select all
<?php
$conn = mysql_connect("***","***","***");
mysql_select_db("***",$conn);
$sql = "SELECT * FROM categorys";
$result = mysql_query($sql,$conn) or die(mysql_error());
while ($r = mysql_fetch_array($result)) {
$cat_id = $r['id'];
$cat_title = $r['title'];
$cat_description = $r['description'];
$cat_supportsite = $r['supportsite'];
$cat_tutcount = $r['tutcount'];
$cat_latestid = $r['latestid'];
echo "<tr>";
echo "<td><font face=\"arial\" size=\"2\"><a href=\"./cats.php?cid=$cat_id\">$cat_title</a> (<i><b>$cat_tutcount</b> Tutorials</i>)";
if ($cat_supportsite != "") {
echo " [About <a href=\"$cat_supportsite\" target=\"_blank\">$cat_title</a>]";
}
echo "<br>$cat_description</font></td>";
echo "</tr>";
}
?>