I have data here:
Here's the result of my first function.The variable I used for the result was $this->arrays.
Array
(
[1] => Array //Transactiondetails of SiteID 1
(
[SiteID] => 1
[Balance] => 2000
[MinBalance] => 1000
[MaxBalance] => 500
[OwnerAID] => 1
[GroupID] => 1
[Deposit] => 10000
[Reload] => 0
[Redemption] => 0
)
)
Now, here's the result of my second function.The variable I used for the result was $this->combined.
Array
(
[0] => Array
(
[AID] => 1
[Sites] => Array
(
[0] => 1 //List of SiteID owned by AID
[1] => 5
)
)
[1] => Array
(
[AID] => 3
[Sites] => Array
(
[0] => 4 //SiteID
)
)
[2] => Array
(
[AID] => 4
[Sites] => Array
(
[0] => 1 //SiteID
)
)
)
I try it with this code:
public function createListOfCorpOwnedSites()
{
foreach ($this->combined as &$site) {
$aids = array();
foreach ($this->result_array as $acct) {
if ($acct['SiteID'] === $site['SiteID'])
$aids[] = $acct['AID'];
}
$site['CorpAID'] = $aids;
}
print_r($this->combined );
}
But, I need a better result, The first one, I need to add the key of CorpAID pointing to the list of a SiteID owned by more than one AID.
Here's should be the result:
Array([0]=> Array(
[SiteID] => 1
[Balance] => 2000
[MinBalance] => 1000
[MaxBalance] => 500
[OwnerAID] => 1
[GroupID] => 1
[Deposit] => 10000
[Reload] => 0
[Redemption] => 0
[CorpAID] => Array(
[0] => 1
[1] => 4
)
Is it possible to make it? Please guide me in proper way, I appreciate your concern and Thank you in advance.