title: How to access mysql result set data with a foreach loop
body: <p>I'm developing a php app that uses a database class to query MySQL.</p>
  <p>The class is here: <a href="http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/" rel="nofollow noreferrer">http://net.tutsplus.com/tutorials/php/real-world-oop-with-php-and-mysql/</a><br><sup>*note there are multiple bad practices demonstrated in the tutorial -- it should not be used as a modern guide!</sup></p>
  <p>I made some tweaks on the class to fit my needs, but there is a problem (maybe a stupid one).</p>
  <p>When using <code>select()</code> it returns a multidimensional array that has rows with 3 associative columns (id, firstname, lastname):</p>
  <pre>
  Array
  (
      [0] => Array
          (
              [id] => 1
              [firstname] => Firstname one
              [lastname] => Lastname one
          )
  
      [1] => Array
          (
              [id] => 2
              [firstname] => Firstname two
              [lastname] => Lastname two
          )
  
      [2] => Array
          (
              [id] => 3
              [firstname] => Firstname three
              [lastname] => Lastname three
          )
  )
  </pre>
  <p>Now I want this array to be used as a mysql result (<code>mysql_fetch_assoc()</code>).</p>
  <p>I know that it may be used with <code>foreach()</code>, but this is with simple/flat arrays. I think that I have to redeclare a new <code>foreach()</code> within each <code>foreach()</code>, but I think this could slow down or cause some higher server load.</p>
  <p>So how to apply <code>foreach()</code> with this multidimensional array the simplest way?</p>