title: PEAR PDO - MySQL to return one associated array?
body: <p>I am using <code>PEAR's PDO library</code> to grab out the results I need.</p>
  
  <p>Whilst I know I could just manually rebuild the array when the results are in, I was wondering is there a internal function I have missed that might do this for me when grabbing results directly from the <code>DB</code>?</p>
  
  <p><strong>Currently:</strong></p>
  
  <pre><code>function get($query){
      $affected =&amp; $this-&gt;conn-&gt;query($query);
  
      // Always check that result is not an error
      if (PEAR::isError($affected)) {
          die($affected-&gt;getMessage());
      }
      $res = $affected-&gt;fetchAll();
      return $res;
  }
  </code></pre>
  
  <p><strong>Returns</strong></p>
  
  <pre><code>[sexnumbers] =&gt; Array
      (
          [0] =&gt; Array
              (
                  [sex] =&gt; 1
                  [no] =&gt; 35
              )
  
          [1] =&gt; Array
              (
                  [sex] =&gt; 2
                  [no] =&gt; 17
              )
  
          [2] =&gt; Array
              (
                  [sex] =&gt; 3
                  [no] =&gt; 3
              )
      )
  </code></pre>
  
  <p><strong>Wanted Result Set</strong></p>
  
  <pre><code>[sexnumbers] =&gt; Array
      (
          [sex] =&gt; Array
              (
                  [0] =&gt; 1
                  [1] =&gt; 2
                  [2] =&gt; 3
              )
  
          [no] =&gt; Array
              (
                  [0] =&gt; 35
                  [1] =&gt; 17
                  [2] =&gt; 3
              )
      )
  </code></pre>