0

what i'm trying to do..

first column 1 cell, next column 2 cells(row span 2), next column 3 cells(row span 3) etc

how can i alter the below code to do that.

the below code displays results across from column to column then once $max(column max) has been reached displays results on a new row.

$foundnum = mysql_num_rows(mysql_query($recent));
$row_count = ceil($foundnum / $max);

echo "<table border='0' cellpadding='0' cellspacing='3' >";
//for every $row_count then increase the $row by 1           
 for($row = 0; $row < $row_count; $row++) {
               echo "<tr>";
// for every $max then increase the $col by 1	
         for($col = 0; $col < $max; $col++) {
		 echo "<td></td>";
		 }
		 echo "</tr>";
		 }
		 echo "</table>";
2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by diafol
0

what i'm trying to do..

first column 1 cell, next column 2 cells(row span 2), next column 3 cells(row span 3) etc

how can i alter the below code to do that.

the below code displays results across from column to column then once $max(column max) has been reached displays results on a new row.

$foundnum = mysql_num_rows(mysql_query($recent));
$row_count = ceil($foundnum / $max);

echo "<table border='0' cellpadding='0' cellspacing='3' >";
//for every $row_count then increase the $row by 1           
 for($row = 0; $row < $row_count; $row++) {
               echo "<tr>";
// for every $max then increase the $col by 1	
         for($col = 0; $col < $max; $col++) {
		 echo "<td></td>";
		 }
		 echo "</tr>";
		 }
		 echo "</table>";

Your loop:

for($row = 0; $row < $row_count; $row++) {
   echo "<tr>";
   for($col = 0; $col < $max; $col++) {
        echo str_repeat("<td></td>", $col + 1);
   }
   echo "</tr>";
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.