In this thread I showed how to have multiple tables 3 wide and 10 down. Like the article says, the hard part is the formatting of the data column-down instead of row-right.
If you'd like a translation of the php, I'd suggest using the asp2php converter.
Now for the fun part.
<?
//if using mysql
$res = mysql_query("SELECT * FROM user");
if (mysql_num_rows($res) > 0){
// Set the num of rows and cols
$cols = 0;
$rows = 0;
$max_cols=3;//this is fixed since we're using 3 arrays
$max_rows=3; //variable
//first we'll put the data into 3 arrays--I think that's what the article does
$arr_counter=1;
$counter_1=0;
$counter_2=0;
$counter_3=0;
while ($data=mysql_fetch_array($res)){
$var='counter_' . $arr_counter;
$arr_data[$arr_counter][$$var]=$data;
$$var++;
$arr_counter++;
if ($arr_counter > 3) $arr_counter = 1;
}
//now we loop through the total count of the first column (since we know that's the number of rows we have)
for ($loop_counter;$loop_counter<$counter_1;$loop_counter++){
if ($rows==0){ //echo out table info
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'>";
}
if ($cols == 0){ //output the tr
echo "<tr style='yfti-irow:0;page-break-inside:avoid;height:1.0in'>";
}
echo "<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";
$var = ='counter_' . $cols;
//basically, if it exists then echo it, otherwise
echo ($loop_counter < $$var)? $arr_data[$cols][$loop_counter][somevariablenametoecho]:' ';
echo "</span></p></td>";
$cols++;
if ($cols == $max_cols){//reset cols, make new row, output trs
echo '</tr>';
$rows++;
$cols=0;
}
if ($rows == $max_cols){//reset rows, end table,put in line break--I substituted <hr>
echo '</table></div><br><hr><br>';
$rows=0;
}
}//end while loop
//now the tricky part, completing the last table
if ($cols == 0 && $rows == 0){//done
}else{//end cols, then end table
while ($cols !=0 && $cols < $max_cols){//don't do if the cols have been reset
echo "<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</td>";
$cols++;
}
if ($cols == $max_cols) echo '</tr>';//to end the row if needed
echo '</table></div>';//to end the table
}//end else
}//end if there are more than 0 rows
?>
This is not tested, and there's probly a syntax error somewhere, but it was fun to write.
Lazzerous, did you read the article😕 😕