title: Ajax and php when inserting into MySQL
body: <p>Simple question guys , i have AJAX that pickup all data from page and it suppose to open new php page to update MySQL database , its only updating last row of data , BUT when i use alert from javascript just to check all data i got he does update whole table ... is there any chance that AJAX is not working fast enough or something? </p>
  
  <p>here is my code </p>
  
  <pre><code>var request_type;
  var browser = navigator.appName;
  
  if (browser == "Microsoft Internet Explorer") {
      request_type = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else {
      request_type = new XMLHttpRequest();
  }
  
  var http = request_type;
  
  var MatchID = '';
  var HomeTeam = '';
  var AwayTeam = '';
  var TipID = '';
  var arrayMaxValues = 3;
  var myArray = new Array(3);
  var i = 0;
  $('#teams_table input[type=text]').each(function () {
  
          myArray[i] = $(this).val();
  
          if (!!myArray[2]) 
          {
                   MatchID = myArray[0];
                   HomeTeam = myArray[1];
                   AwayTeam = myArray[2];
  
  
             if (HomeTeam &gt; AwayTeam) {
                    TipID = 1;
             }
             else if (HomeTeam == AwayTeam) {
                    TipID = 2;
             }
             else if (HomeTeam &lt; AwayTeam) {
                    TipID = 3;
             }
  
  
  
             http.open('get', 'adminUpdate.php?MatchID=' + MatchID + '&amp;TipID=' + 
             TipID + '&amp;HomeTeam=' + HomeTeam + '&amp;AwayTeam=' + AwayTeam, true);
             http.send(null);
  
             myArray = new Array(3);
             i=0;
  
          }
          else
          {
           i++;
          }
  
  });
  </code></pre>
  
  <p>It is kinda odd to me when i use </p>
  
  <pre><code> alert('MatchID = ' + MatchID + ' HomeTeamScore = ' + HomeTeam + ',
   AwayTeamScore = ' + AwayTeam)
  </code></pre>
  
  <p>Inside of AJAX code i get whole table updated , without it just last row</p>
  
  <p>And my php page</p>
  
  <pre><code>&lt;?php
  
  include('config.php');
  
  $matchID = $_GET['MatchID'];
  $tipID = $_GET['TipID'];
  $HomeScore = $_GET['HomeTeam'];
  $AwayScore = $_GET['AwayTeam'];
  
  $query="update probatip1.matches set ResultTipID=".$tipID.",HomeTeamScore = "
  .$HomeScore.",AwayTeamScore= ".$AwayScore." where MatchID =".$matchID;
  
  $UpdateGame= mysql_query($query) or die(mysql_error());
  
  mysql_close()
  
  ?&gt; 
  </code></pre>