Welcome Guest, Not a member yet? Register   Sign In
Merging arrays from different queries
#1

[eluser]JanDoToDo[/eluser]
Hey guys,

Im making a recent activity feed. I have multiple tables with different info, eg members, messages, alerts etc.

From each table I get the last 4 results by date, most recent first.

I want to combine each 3 arrays and then dump the whole array in date order.

How would I go about doing this? Obviously each table has different columns but each does have a date column. At the minute I loop through each array separately and then echo but that means i have all the new members in date order, then the new messages in date order and then alerts in date order. However I want the whole lot in date order not split between category.

I was thinking either have an entire new table of recent activity and then put an entry in there for everything that happens or alternatively merge the arrays some how and then re sort by date but i dont know how to do it. Having a whole new table for activity seems inefficient and is replicating data.

Ive tried merging but each array has different keys and stuff and so can anyone advise the best way to do this?


Messages In This Thread
Merging arrays from different queries - by El Forum - 08-30-2010, 08:16 AM
Merging arrays from different queries - by El Forum - 09-02-2010, 12:49 AM
Merging arrays from different queries - by El Forum - 09-02-2010, 01:51 AM
Merging arrays from different queries - by El Forum - 09-02-2010, 07:57 AM
Merging arrays from different queries - by El Forum - 09-02-2010, 08:58 AM
Merging arrays from different queries - by El Forum - 09-02-2010, 12:39 PM
Merging arrays from different queries - by El Forum - 09-02-2010, 12:46 PM



Theme © iAndrew 2016 - Forum software by © MyBB