Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to Create a Key and Bind the Array Values in Multidimensional Way PHP
    primarykey
    data
    text
    <p>I have data here:</p> <p>Here's the result of my first function.The variable I used for the result was $this->arrays.</p> <pre><code>Array ( [1] =&gt; Array //Transactiondetails of SiteID 1 ( [SiteID] =&gt; 1 [Balance] =&gt; 2000 [MinBalance] =&gt; 1000 [MaxBalance] =&gt; 500 [OwnerAID] =&gt; 1 [GroupID] =&gt; 1 [Deposit] =&gt; 10000 [Reload] =&gt; 0 [Redemption] =&gt; 0 ) ) </code></pre> <p>Now, here's the result of my second function.The variable I used for the result was $this->combined. </p> <pre><code>Array ( [0] =&gt; Array ( [AID] =&gt; 1 [Sites] =&gt; Array ( [0] =&gt; 1 //List of SiteID owned by AID [1] =&gt; 5 ) ) [1] =&gt; Array ( [AID] =&gt; 3 [Sites] =&gt; Array ( [0] =&gt; 4 //SiteID ) ) [2] =&gt; Array ( [AID] =&gt; 4 [Sites] =&gt; Array ( [0] =&gt; 1 //SiteID ) ) ) </code></pre> <p>I try it with this code:</p> <pre><code> public function createListOfCorpOwnedSites() { foreach ($this-&gt;combined as &amp;$site) { $aids = array(); foreach ($this-&gt;result_array as $acct) { if ($acct['SiteID'] === $site['SiteID']) $aids[] = $acct['AID']; } $site['CorpAID'] = $aids; } print_r($this-&gt;combined ); } </code></pre> <p>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.</p> <p>Here's should be the result:</p> <pre><code> Array([0]=&gt; Array( [SiteID] =&gt; 1 [Balance] =&gt; 2000 [MinBalance] =&gt; 1000 [MaxBalance] =&gt; 500 [OwnerAID] =&gt; 1 [GroupID] =&gt; 1 [Deposit] =&gt; 10000 [Reload] =&gt; 0 [Redemption] =&gt; 0 [CorpAID] =&gt; Array( [0] =&gt; 1 [1] =&gt; 4 ) </code></pre> <p>Is it possible to make it? Please guide me in proper way, I appreciate your concern and Thank you in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload