title: Create array of associative arrays
body: <p>I want to create an array of associative arrays in a while loop. In each iteration of the while loop I want to add a new element in the array. How I can do that? After that I want to pass this array in a foreach and print the data. I have this part of code for now but obviously something is wrong with that.</p>
  <pre><code>while($row2 = mysql_fetch_array($result))
  { 
      $myarray = array(&quot;id&quot;=&gt;$theid, &quot;name&quot;=&gt;name($id), &quot;text&quot;=&gt;$row2['text']);
  }
  </code></pre>