title: PHP query and repeat mysql_fetch_array
body: <p>I have  some code that works, but is clunky and am wondering if there is a better way to do it, first the code, and then i will explain:</p>
  
  <pre><code>// repeat query 10 times
  for ($i = 1; $i &lt;= 10; $i++) {
     $query = @mysql_query("SELECT fileName FROM images");
      while($row = mysql_fetch_assoc($query)){
          extract($row);
          echo "&lt;img src='images/images/$fileName'/&gt;";
      }
  }
  </code></pre>
  
  <p>I would like to repeat a set of images whose file names are stored in a mySql table. The code above repeats the query 10 times. I would rather query once, then repeat the list. Is there a way to do this, either on the mySql side or in the php loop?</p>
  
  <p>Thanks.</p>