title: PHP equivalent for .NET's DataTable.Select(expression)?
body: <p>I'm going to optimize the data access layer of my php web application.  Currently, my php web application makes a lot of queries (some possibly redundant) to the database.   I want to reduce the number of queries to the database by writing only a few more complex queries that return larger and more generic data sets.  I then want to store these results in the $GLOBALS variable.</p>
  
  <p>Then I can access the data elsewhere in my web application like so:</p>
  
  <pre><code>$GLOBALS['dbResults1'] = $dbObject-&gt;get();
  $result = new ResultWrapper($GLOBALS['dbResults1']);
  $array_eligible_athletes = $result-&gt;Select(' age &gt; 20 ');
  $array_obese = $result-&gt;Select(' bmi &gt; 100 ')-&gt;orderBy('lastname,firstname desc');
  etc...
  </code></pre>
  
  <p>as opposed to my current way of:</p>
  
  <pre><code>// each of these makes a trip to the database
  $array_eligible_athletes = $dbObject-&gt;getWhere('age &gt; 20'); 
  $array_obese = $dbObject-&gt;getWhere('bmi &gt; 100')-&gt;orderBy('lastname,firstname desc');
  etc...
  </code></pre>
  
  <p>So my questions are:</p>
  
  <p>1) Is my new approach a good idea?  What is the likelihood my new approach will improve the performance of my web application?</p>
  
  <p>2) If 1) is a good idea, are there libraries out there that do what I want?  Ie. a better way of querying and managing datasets.</p>
  
  <p>I really enjoyed the DataTable.Select() feature in the .Net framework, and was hoping for something similar in PHP development.  If one doesn't exist, anything solution that helps me reduce calls to db would be great.</p>