Welcome Guest, Not a member yet? Register   Sign In
php mod % 3
#1

[eluser]webdezzo[/eluser]
Hey all,

This may or may not be a CI question (CI may have something useful to use for this) But, since this community rocks, I figured what the heck.

Lets say I have a 3 column layout like so:

Code:
<div id='column1'>
Content 1
</div>

<div id='column2'>
Content 2
</div>

<div id='column3'>
Content 3
</div>

And I select some data from my Database, that may return any number of records. I want to split this data into 3 arrays, that are equal (close plus or minus 1 due to odd / even) in length, so that echo the data from the 3 diffrent arrays in each column respectively. How could one go about doing this?

I would typically handle it if it were 2 columns with the mod function (% 2) but I am a little thrown off with the third column. I figure splitting the array based on the data would be the easiest method. Does CI have any easy array splitting functionality that I could say, take this data, split it into 3 arrays by taking the returned records and dividing them by 3?

Any ideas would be much appreciated!
Thanks!


Messages In This Thread
php mod % 3 - by El Forum - 10-18-2007, 06:07 PM
php mod % 3 - by El Forum - 10-18-2007, 08:01 PM
php mod % 3 - by El Forum - 10-18-2007, 10:00 PM
php mod % 3 - by El Forum - 10-18-2007, 10:07 PM
php mod % 3 - by El Forum - 10-19-2007, 03:31 AM
php mod % 3 - by El Forum - 10-29-2007, 04:04 PM
php mod % 3 - by El Forum - 10-31-2007, 05:24 AM
php mod % 3 - by El Forum - 10-31-2007, 08:23 AM
php mod % 3 - by El Forum - 10-31-2007, 09:03 AM
php mod % 3 - by El Forum - 10-09-2008, 04:07 PM
php mod % 3 - by El Forum - 10-09-2008, 09:06 PM
php mod % 3 - by El Forum - 10-09-2008, 11:17 PM
php mod % 3 - by El Forum - 10-10-2008, 12:34 AM
php mod % 3 - by El Forum - 10-10-2008, 03:38 AM
php mod % 3 - by El Forum - 10-10-2008, 12:23 PM
php mod % 3 - by El Forum - 10-11-2008, 09:36 AM
php mod % 3 - by El Forum - 10-11-2008, 01:42 PM



Theme © iAndrew 2016 - Forum software by © MyBB