...

View Full Version : Split one long row into columns ?



BoNfiRe
08-31-2007, 02:18 PM
I have been trying to get this code if over a certain size to display in another row but to no avail...

Here is the code..


$c=@mysql_data_seek($catquery,0);

if($c) {
echo "<div class='tableborder'><table><tr>";
while ($c = mysql_fetch_array($catquery)) {

echo "<td width='5%' align='center' class='arcade1'><a href='Arcade.php?cat=$c[0]'>$c[1]</a></td>";
}
echo"</tr></table></div>";
echo "<br />";
}


Any help would be greatly appreciated.

TY
BoN

Mwnciau
08-31-2007, 02:51 PM
$c=@mysql_data_seek($catquery,0);
$cols = 5; // number of columns

if($c) {
echo "<div class='tableborder'><table>";
$i = 0;
while ($c = mysql_fetch_array($catquery)) {
if ($i == 0) echo "<tr>";
echo "<td width='5%' align='center' class='arcade1'><a href='Arcade.php?cat=$c[0]'>$c[1]</a></td>";
$i++;
if ($i == $cols){
$i = 0;
echo '</tr>';
}
}
if ($i != 0) echo '</tr>';
echo"</table></div>";
echo "<br />";
}

BoNfiRe
08-31-2007, 02:56 PM
Sweet tyvm.. Works like a charm..
I was trying


$c=@mysql_data_seek($catquery,0);

if($c) {
echo "<div class='tableborder'><table><tr>";
while ($c = mysql_fetch_array($catquery)) {

if($c<5)
echo "<td width='5%' align='center' class='arcade1'><a href='Arcade.php?cat=$c[0]'>$c[1]</a></td>";
}else{
echo "<tr align='center' class='arcade1'><a href='Arcade.php?cat=$c[0]'>$c[1]</a></tr>";
}
echo"</tr></table></div>";
echo "<br />";
}


But it kept messing the tables up :|

Thanks again ;)
BoN



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum