Display output in 2 colomns
| From: | Daniel Harik | Date: | Tue, 25 Dec 2001 14:09:05 +0000 |
| Subject: | Display output in 2 colomns | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-78776@lists.php.net to get a copy of this message | ||
Hello guys
I have following code, it splits 1 array into 2(to make 2 colomns
out of 1) and then displays it, but for some reason it only displayes
1 array not second
--------
$i=0;
$this->query( "select * from topics");
while($this->fetchRow()){
$array[$i] = $this->record["name"];
$i++;
}
$count = count($array);
$count = $count/2;
$count = round($count,0);
$x = 0;
echo "<table>\n";
foreach($array as $key => $value) {
if ($x <=$count) {
$array1[] = $value;
} elseif($x > $count) {
$array2[] = $array[$x];
}
echo "<tr><td>$array1[$x]</td><td>$array2[$x]</tr>\n";
$x++;
}
echo "</table>\n";
---
Thank You very much
--
Best regards,
Daniel mailto:gatop@hot.ee