title: undefined offset and syntax error but code is executed properly
body: <p>ajax:</p>
  
  <pre><code>... 
  success: function(data){
          console.log(data);
      }
  </code></pre>
  
  <p><strong>position.php</strong>  </p>
  
  <p>Two arrays are transfered (<code>$ids</code> and <code>$indexes</code>), with the equal number of elements.</p>
  
  <pre><code>extract($_POST);
  
  print_r($ids);
  print_r($indexes);
  
  for ($i = 0; $i &lt;= count($ids); $i++) {
      $stmt = $db-&gt;query("UPDATE " . $table . " SET inde = " . $indexes[$i] . " WHERE id = " . $ids[$i]); // this is line 10
  }
  </code></pre>
  
  <p>The code is executed properly, i.e. all table data are updated as expected, but console (after listing the arrays) shows some errors:</p>
  
  <pre><code>    Array
      (
          [0] =&gt; 25
          [1] =&gt; 23
          [2] =&gt; 18
          [3] =&gt; 26
          [4] =&gt; 21
      )
      Array
      (
          [0] =&gt; 0
          [1] =&gt; 1
          [2] =&gt; 2
          [3] =&gt; 3
          [4] =&gt; 4
      )
  
  &lt;b&gt;Notice&lt;/b&gt;:  Undefined offset: 5 in &lt;b&gt;D:\matria\s02\admin\position.php&lt;/b&gt; on line &lt;b&gt;10&lt;/b&gt;&lt;br /&gt;
  
  &lt;b&gt;Fatal error&lt;/b&gt;:  Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064... near 'WHERE id =' at line 1 in D:\matria\s02\admin\position.php:10  
  </code></pre>
  
  <p>Any help?</p>