I did this the other day. Thing is I used it for an array, not a mysql db, but I changed it for mysql, hopefully this'll work. Here you go:
PHP Code:
<div id='sss' class='col'>
<h4>for sale</h4>
<div class='cats'> <div class='cats'><ul id='ccc1'>
<?php
echo '<table border="0" cellspacing="10" cellpadding="0" align="center">';
function print_data($rows, $cols, $offset) {
if($rows > 0) {
$res = mysql_query("select * from post_subtypes where postid=16 LIMIT $offset,$rows");
$offset = $offset + $cols;
echo "
<tr>";
while($var = mysql_fetch_array( $res )) {
echo '
<td>
<li><a href="sale1.php?id='.$var[cid].'"><font size="2">'.$var[name].'</font></a></li>
</td>';
}
echo "
</tr>";
$rows = $rows - 1;
print_data($rows, $cols, $offset);
}
}
echo"</ul>";
$rows = 5000; //rows to display
$cols = 2; //columns to display
$offset = 0; // offset, good for paging
print_data($rows, $cols, $offset);
echo "</table>";
?>
</div>
</div>
HTH
Bookmarks