title: PHP Script loops not working
body: <p>I have the following script:</p>
  
  <pre><code>&lt;?php
  ini_set('max_execution_time', 0);
  include("../includes/mysqli.php");
  $pointsvar = 50000;
  $inserts = 0;
  $locationvar = 32000006;
  
  while($locationvar &lt;= 32000260){
  
      while($pointsvar &gt;= 20000){
  
          $url = "http://185.112.249.77:9999/Api/Search?search=&amp;level=0&amp;min=1&amp;max=50&amp;points=$pointsvar&amp;loc=$locationvar";
          $jsondata = file_get_contents($url);
          $data = json_decode($jsondata, true);
  
          $in=$data['clanList'];
          $results = $data['results']; //max is 64
          $i = 0;
  
          while($i + 1 &lt;= $results){
  
              $clanid = $in[$i]['id'];
              $clanname = mysqli_real_escape_string($con,$in[$i]['name']);
              $clanplayerCount = $in[$i]['playerCount'];
              $clanwarswon = $in[$i]['warsWon'];
              $clanwarslost = $in[$i]['warsLost'];
              $clanwarstied = $in[$i]['warsTied'];
              $clanLocation = mysqli_real_escape_string($con,$in[$i]['clanLocation']);
              $clanlevel = $in[$i]['level'];
              $score = $in[$i]['score'];
  
              $sql = "INSERT INTO activeclans(id, name, location, playercount, clanlevel, warswon, warslost, warstied, score)
              VALUES('$clanid', '$clanname', '$clanLocation', '$clanplayerCount', '$clanlevel', '$clanwarswon', '$clanwarslost', '$clanwarstied', $score)";
  
              mysqli_query($con, $sql);
              $i++;
              $inserts++;
          }
          $pointsvar = $pointsvar-500;
          sleep(1);
      }
      $locationvar++;
      sleep(1);
  }
  echo "Inserted $inserts";
  ?&gt;
  </code></pre>
  
  <p>When I run it I am expecting it to go through each location and in each location I expect it to -500 from the <code>$pointsvar</code> until it reaches 20000. It was working until I made it go through each location in a while loop and now it just outputs <code>Inserted 0</code></p>
  
  <p>I have increased the max_execution_time as it could possible take a looong time to run. This script will be run on a cron around every day or week.</p>
  
  <p>The expected output would be <code>Inserted</code> and a very very very big number..</p>
  
  <p>Thanks for any help you can provide :D</p>