Permalink
Browse files

Create Tables dynamically

  • Loading branch information...
whotooktwarden committed Jul 22, 2015
1 parent 63d2ae6 commit f46f875a37741f892edaa1ec5eef9f24878baed7
Showing with 23 additions and 0 deletions.
  1. +23 −0 tables.php
@@ -0,0 +1,23 @@
<?php
//This script will create a table that has 2 row and 4 cells.
//Edit the integer after $end/ as well as $y < # to specify row maximum
$end=7; //will get all this data from a dabase
$rows=ceil($end/4);
$x=0;
$start=0;
?>
<table>
<?php
while($x<=$rows) {
echo "<tr>";
for ($y = 0; $y < 4; $y++, $start++) {
if ($start <= $end) echo "<td>$start</td>";
}
echo "</tr>";
$x++;
}
?>
</table>

0 comments on commit f46f875

Please sign in to comment.