View Single Post
ThunderPoit
Making sawdust
 
Join Date: May 2004
Location: Minnesota
 
2007-11-16, 22:54

dont really need any help here, just happy for myself.
ive been trying to teach myself php/mysql to set up a comic site for my gf, and after getting a little bored with the book i was using, i decided to play around a little bit and see what i could do w/o an example sitting in front of me.

And here is what i made:

[PHP]<table border="1">
<?php
$row = 0;
while ($row < 4) {
$column = 0;
echo ("\t<tr>\n");
while ( $column < 3 ) {
echo ("\t\t<td>\n");
echo ("\t\t\tColumn = $column<br>\n\t\t\tRow = $row\n");
echo ("\t\t</td>\n");
$column++;
}
echo ("\t</tr>\n");
$row++;
}
?>
</table>[/PHP]

and here is the pretty code it writes!:

Code:
<table border="1"> <tr> <td> Column = 0<br> Row = 0 </td> <td> Column = 1<br> Row = 0 </td> <td> Column = 2<br> Row = 0 </td> <tr> <td> Column = 0<br> Row = 1 </td> <td> Column = 1<br> Row = 1 </td> <td> Column = 2<br> Row = 1 </td> <tr> <td> Column = 0<br> Row = 2 </td> <td> Column = 1<br> Row = 2 </td> <td> Column = 2<br> Row = 2 </td> <tr> <td> Column = 0<br> Row = 3 </td> <td> Column = 1<br> Row = 3 </td> <td> Column = 2<br> Row = 3 </td> </table>
It writes a 3x4 table

hooray for me and my kindergarten level php skills!

ps, if anyone knows a better or cleaner way to do this, let me know, im happy to learn!

edit: oh wow, i just realized i wasnt closing out my rows! fixed now!
  quote