View Full Version : Listing query results in columns
DjSap
02-27-2002, 12:23 PM
Well im working on a classifieds hack for my board and i want to display all the categories evenly divided in a table with 3 columns and 1 row, only thing im able to do right now is display the results in rows. I havent been able to find a tutorial or something about this so could someone help me out on this?
Admin
02-27-2002, 01:58 PM
In general:
<?php
$result = $DB_site->query("SELECT * FROM tblName");
$cellcounter = 0;
while ($row = $DB_site->fetch_array($result) and ++$cellcounter) {
if ($cellcounter%3 == 0) {
echo "<tr>\n";
}
echo "<td>" . $data . "</td>\n";
if ($cellcounter%3 == 0) {
echo "</tr>\n";
}
}
?>
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.