title: Loop mysql_fetch_assoc using foreach instead of a while loop
body: <p>I have a mysql query:</p>
  
  <pre><code>$result = mysql_query("my query");
  </code></pre>
  
  <p>Is there a way to make something like this work? </p>
  
  <pre><code>$results = mysql_fetch_assoc($result); // fetch the results
  </code></pre>
  
  <p>And loop them using foreach instead of the classic while:</p>
  
  <pre><code>foreach($results as $result){
     $result1 = $result-&gt;result1;
     $result2 = $result-&gt;result2;
  }
  </code></pre>
  
  <p>Ty</p>