[FX.php List] PHP Question

Bob Patin bob at patin.com
Thu Jul 20 11:12:04 MDT 2006


While I've not done it, I know how I would go about this:

$counter = 4;
foreach($foundSet['data'] as $key=>$foundData){
	if ($counter = 4){
		$counter = 0;
		?>
		<?php
		<tr> //create a new table row
		?>
	<?php
	}
	if ($counter < 4){
	?>	
		<td width=33%>... create your new column, specify column width here  
as well (I assume it'd be 33%)
		$counter = $counter + 1;
	<?php
	}
}
?>

This might need tweaking; I just dashed this off, but I think this  
would work fine...

Let me know how it goes...

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com

   CONTACT US VIA INSTANT MESSAGING:
      AIM or iChat: longterm1954
      Yahoo: longterm_solutions
      MSN: tech at longtermsolutions.com
      ICQ: 159333060



	




So essentially you'd have a loop within a loop; the main loop is  
looping through the found set. The internal loop creates columns (3  
at the max for your example), then exits the loop to start a new row.



On Jul 20, 2006, at 11:56 AM, David Tinoco wrote:

> I guess this is more a php question, but does anyone know how to  
> write a piece of code that could write the html for the foundcount  
> of a query from the database in columns, as well as rows?
>
> For example:
>
> Category1            Category2                  Category3
> Category4            Category5                  Category6
>
> Instead of:
>
> Category1
> Category2
> Category3
> Category4....and so on.
>
> Thanks!
> David
>
> With MSN Spaces email straight to your blog. Upload jokes, photos  
> and more. It's free! It's free!
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20060720/f409221a/attachment.html


More information about the FX.php_List mailing list