title: replace while loop with foreach
body: <p>I have a php code like this:</p>
  
  <pre><code>$categories_query = tep_db_query("select categories_id, categories_name from categories order by categories_name");
  while ($categories = mysql_fetch_array($categories_query)) {
  $categories_array[] = array('id' =&gt; $categories['categories_id'], 'text' =&gt; $categories['categories_name']);
  }
  </code></pre>
  
  <p>question is how can I replace the while loop with for example foreach so I can first fetch mysql array, then I want to edit some values and then pass it on to a loop? I tried different versions of loops but they don't give me the same result as the while loop does.</p>