-
- CommentAuthorcthelight
- CommentTimeJul 10th 2008
I have a script that needs to loop through a lot of data. I am going to use tables (if any can do the css that would be better) and I am running into this bump. I want it to look like this:
+------+ +------+
|Data | |Data |
+------+ +------+
|data | |data |
+------+ +------+
But it looks like this
+------+
|Data |
+------+
|data |
+------+
+------+
|Data |
+------+
|data |
+------+
How do I get it like the first example? -
-
CommentAuthorgreg
- CommentTimeJul 10th 2008
first example:<table>
<tr>
<td>data</td>
<td>data</td>
</tr>
<tr>
<td>data</td>
<td>data</td>
</tr>
</table>
so for your loop, you'd want something like:$i = 0;
$table = "<table>";
while (whatever) {
if ($i == 0) {
$table .= "<tr><td>$data</td>
$i++;
}
else {
$table .= "<td>$data</td></tr>
$i--;
}
}
$table .= "</table>";
pretty sure that should work. -
-
- CommentAuthorcthelight
- CommentTimeJul 11th 2008
Ok, ill try that...
1 to 3 of 3
