title: inserting same query from multiple array
body: <p>I make a mathematichs function in mysql. and give two result because it`s calculate from 2 records. this is the source :</p>
  
  <pre><code>$calculate= mysql_query("select markers_tujuan.lng,markers_tujuan.lat,open_list.lat, open_list.lng,
  ((SQRT((((markers_tujuan.lat-markers_tujuan.lng)*(markers_tujuan.lat-markers_tujuan.lng)) + ((open_list.lat-open_list.lng)*(open_list.lat-open_list.lng)))))+(sqrt((((markers_tujuan.lat-open_list.lat)*((markers_tujuan.lat-open_list.lat)))+((markers_tujuan.lng-open_list.lng)*((markers_tujuan.lng-open_list.lng))))))) 
  as hasil
  from markers_tujuan, open_list");
  
  $op=mysql_query("select * from open_list");
  $line=mysql_fetch_assoc($op);
  
  
  /* fetch associative array */
  while ($row = mysql_fetch_assoc($calculate)) {
      printf ("1(%s %s),(%s %s),%s &lt;br&gt; \n", $row["lng"], $row["lat"], $row["lat"], $row["lng"], $row["hasil"]);
          $try=mysql_query(" UPDATE open_list SET hitung = '".$row["hasil"]."' ");
      }
  </code></pre>
  
  <p>and the result is
  <img src="https://i.stack.imgur.com/0TV11.jpg" alt="php running"></p>
  
  <p>but I didn`t understand why query in mysql updating same query</p>
  
  <p><img src="https://i.stack.imgur.com/4esX3.jpg" alt="error query"></p>