title: output xml array parsing php repeated six times
body: <p>I have a php file in this format:</p>
  
  <pre><code>&lt;?php
  $username = "root";
  $password= "";
  $db = "kamus1";
  mysql_connect("localhost",$username,$password) or die("koneksi ke MySQL gagal");
  mysql_select_db($db) or die ("koneksi ke dataBase gagal");
  
  $doc = new DomDocument('1.0');
  $root = $doc-&gt;createElement('movies');
  $root = $doc-&gt;appendChild($root);
  $arr = array();
  
  //$query=mysql_query("select id,istilah,definisi from kamus_jaringan");
  $query=mysql_query("select * from kamus_jaringan");
  while($get_data = mysql_fetch_array($query))
  {
  foreach($get_data as $fieldname=&gt;$fieldvalue)
  {
  
  $item = $doc-&gt;createElement('movie');
  $item = $root-&gt;appendChild($item);
  $item -&gt;setAttribute("id",$get_data["id"]);
  $item -&gt;setAttribute("istilah",$get_data["istilah"]);
  $item -&gt;setAttribute("definisi",$get_data["definisi"]);
  }
  }
  echo $doc-&gt;saveXML();
  $doc-&gt;save("movies.xml");
  ?&gt;
  </code></pre>
  
  <p>when this code is executed on the browser, the output of each of the data will be repeated up to six times. for example id, will repeat six times. I want the output to each of the data, only one time. please help</p>