title: Create dynamic associated array from database fields
body: <p>I got a database with 2 fields: amount and name.
  I want to get all the data from the database (40 rows) and create an associated array out of it like this:</p>
  
  <pre><code>$arr = array("amount" =&gt; "12", "name" =&gt; "John");
  </code></pre>
  
  <p>How is this done dynamically in PHP? I am stuck.</p>