title: Group the output of PDO query
body: <p>I have a PDO query in which I am doing inner join on two tables and extracting the columns required by me.
  Now these two columns are - status, script.
  <strong>Status</strong> can be  - <code>passed, failed, incomplete and</code></p>
  
  <p><strong>script</strong> - <code>scripts/testSuite/layer3Features/ManualStaticRouting/manualStaticRoutes.tcl ,  scripts/testSuite/hostAgentFeatures/dhcp/DHCP IPv6/RelayBBasicFunc/ipv6DhcpRelayEnableDhcpv6RelayGlobally.tcl</code></p>
  
  <p>the output of --</p>
  
  <pre><code>while($row = $getFamily-&gt;fetch(PDO::FETCH_ASSOC))
          { 
          foreach($row as $key) 
              {
                  print_r($row);
  }
  </code></pre>
  
  <p>is - </p>
  
  <blockquote>
    <p><a href="http://pastebin.com/WqcibEyp" rel="nofollow">http://pastebin.com/WqcibEyp</a></p>
  </blockquote>
  
  <p>the full query is - </p>
  
  <pre><code>$testType = 'TCL';
  
      $getFamily = $conn-&gt;prepare('SELECT testcases2.script, results3.status FROM testcases2 INNER JOIN results3 ON testcases2.testcaseID = results3.testcaseID
      WHERE testType = :testType');
  
      $getFamily-&gt;execute(array(':testType' =&gt; $testType));
  
        while($row = $getFamily-&gt;fetch(PDO::FETCH_ASSOC))
          { 
          foreach($row as $key) 
              {
                  print_r($row);
                  $family[] = $key;
              }           
          }
  </code></pre>
  
  <p>Now here what I want to do is, read the second location of each script (considering scripts at 0) and group all the values which have same stuff in the third location, with status together.</p>
  
  <p>How this can be done.
  Please guide.</p>