Creating a Complex Loop
I'm create a loop for a database user list to print in a table 3 accorss 10 down.
This will fill a page then when this value is reach (which is 30 Results) then a page break is inserted I have it working with out the database but when I add the data and try to count the rows it does'nt work well.
here is the code minus the page break part
<?
require_once('../../../includes/database.php');
$res = db_query("SELECT count(*) as num
FROM user");
$num = db_result($res, 0,"num");
#this is the area that works
#I try to count the rows form the data base abd replace the row value with the results then page break on every 30 results
// Set the num of rows and cols
$cols = 3;
$rows = 10;
for ($i = 1; $i <= $rows; $i++) {
echo "<div class=Section1>
<table class=NormalTable
border=0
cellspacing=2 cellpadding=2
style='border-collapse:collapse;padding-top-alt:0in;padding-bottom-alt: 0in'>";
echo "<tr style='yfti-irow:0;page-break-inside:avoid;height:1.0in'>";
for ($x = 1; $x <= $cols; $x++) {
$output = "<td width=252
style='width:189.0pt;padding:0in .75pt 0in .75pt;height:1.0in'>
<p class=Normal
align=center
style='margin-top:0in;
margin-right:5.3pt;
margin-bottom:0in;
margin-left:5.3pt;
margin-bottom:.0001pt;text-align:center'>
<span class=SpellE>xxx";
echo "</span></p></td>";
echo "$output";
} // end for cols
echo "</tr>";
echo "</table></div>";
} // end Rows
?>
If any can help theat would be great been fighting with this for a week
Thanks in advance