title: Insert into a db data coming from a loop (while)
body: <p>hi have a code like this</p>
  
  <pre><code>for ($i=0; $i&lt;=count($query)+1 ; $i++)
   {
  $sql ="SELECT * FROM $tabella[$i] WHERE id='1'";
  $result=mysql_query($sql);
  $numrows=mysql_num_rows($result);
  
  while($row = mysql_fetch_array($result))
  {
  $name=$row['name'];
  $surname=$row['surname'];
  
  INSERT INTO student (name,surname) Values ($name,$surname)
  } 
  
  }
  </code></pre>
  
  <p>It insert the data only from the first table he found so only one name and one surname and not all the $name and $surname with id=1</p>
  
  <p>How can I resolve it</p>