title: Loop MySQL-Query 10 times for each item in array (PHP & MySQL)
body: <p>I'm trying to write a Top-10 list with categories but it doesn't work in the way i want it to. There's an array with a dynamic number (n) of items and want to loop each item in this array 10 times to write n*10 rows into a MySQL table. ($i also increments the games rank).
  If I echo, print_r or var_dump the code it works, but when I try to write it to the MySQL table it doesn't work. </p>
  
  <p>Here's the code:</p>
  
  <pre><code>for ($i = 1; $i &lt;= 10; $i++) {
  foreach($titles as $val) {
  $query .=  "INSERT INTO charts (game_place, game_name, game_preweek, game_developer, game_release, game_link, game_image, game_category, charts_updated) VALUES (".$i.", '', '', '', '', '', '', '".$val."', '".time()."');";
  mysql_query($query);
  };
  };
  </code></pre>
  
  <p>Does somebody know the answer to my problem?</p>