title: issues with show array in one row in php
body: <p><img src="https://i.stack.imgur.com/OMvT8.png" alt="enter image description here"></p>
  
  <p>I want to show one agent per row with all appointments, call backs, etc...</p>
  
  <p>I tried to put in for loop within for loop. But, It's not giving me correct result.</p>
  
  <p>CODE:</p>
  
  <pre><code>foreach($agents_summary as $as){
  &lt;tr&gt;
    &lt;td&gt;&lt;?=$as['index']?&gt;&lt;/td&gt;
    ... etc...
  &lt;/tr&gt;
  </code></pre>
  
  <p>ARRAY SAMPLE:</p>
  
  <pre><code>Array
  (
  [0] =&gt; Array
      (
          [agent_id] =&gt; 1
          [first_name] =&gt; Ronak
          [last_name] =&gt; Patel
          [transaction_type] =&gt; APPOINTMENT
          [transaction_count] =&gt; 5
      )
  
  [1] =&gt; Array
      (
          [agent_id] =&gt; 1
          [first_name] =&gt; Ronak
          [last_name] =&gt; Patel
          [transaction_type] =&gt; CALL_BACK
          [transaction_count] =&gt; 5
      )
   .....
   AND SO ON...
  </code></pre>
  
  <p>EDIT:
  DATABASE QUERY:</p>
  
  <pre><code>SELECT
  a.id AS agent_id,
  a.first_name AS first_name,
  a.last_name AS last_name,
  ct.transaction_type AS transaction_type,
  count(*) AS transaction_count
  FROM agent AS a
  INNER JOIN client_transaction AS ct
  ON a.id=ct.generated_by_id
  WHERE ct.transaction_type = 'APPOINTMENT'
  OR ct.transaction_type = 'CALL_BACK'
  OR ct.transaction_type = 'SENT_EMAIL'
  OR ct.transaction_type = 'SALE'
  GROUP BY agent_id, transaction_type
  ORDER BY `agent_id` ASC, `transaction_type` ASC
  </code></pre>