Re: Table trouble

From: Date: Mon, 07 Jul 2003 22:19:10 +0000
Subject: Re: Table trouble
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-154264@lists.php.net to get a copy of this message
I'd just dump all of the results into an array and do something like this: echo "<table border=1>\n"; for($i=0; $i<count($array);) { echo "\t<tr>\n"; for($j=0; $j<2; $j++) { echo "\t\t<td>".$array[$i]."</td>\n"; $i++; } echo "\t</tr>\n"; } echo "</table>\n"; On odd numbered arrays you'll end up with an empty cell. Most browsers will handel the empty cell by simply not displaying it. Others might show the box. It's a minor cosmetic thing but if you want it to look consistent then test for that situation and add a non-breaking space to the final cell. HTH, Kevin ----- Original Message ----- From: "phpu" <phpu@go.ro> To: <php-general@lists.php.net> Sent: Monday, July 07, 2003 4:03 PM Subject: [PHP] Table trouble Hello I need help. I'm querying a database then printing the results in a table. I want the result to be in a table with 2 columns per row. something like that -------------------------------------------------------- -- -- -- -- row 1 -- row 2 -- -- -- -- -------------------------------------------------------- -- -- -- -- row 3 -- row 4 -- -- -- -- -------------------------------------------------------- -- -- -- -- row 5 -- row 6 -- -- -- -- -------------------------------------------------------- and so on..... How can I do that? Please help me asap

« previous php.general (#154264) next »