title: PDO dblib over freetds resets fetch of query on sql server 2000 if another query is issued inside a fetch loop
body: <p>Ok, so we've got a new server with </p>
  
  <ul>
  <li>Debian Wheezy 32BIT</li>
  <li>PHP 5.5.18</li>
  <li>FreeTDS 0.91</li>
  </ul>
  
  <p>This PHP app needs to talk to an old SQL server 2000 server. We used the old code from our previous server (PHP 5.2 and older FreeTDS - can't get the version).
  We connect to SQL server 2000 through PDO using dblib driver.</p>
  
  <p>We're experiencing weird behaviour with the fetch function. Basically if we issue a query during a fetch loop on the same pdo connection object, the main query gets reset and next fetch call will return false even if there are still records to be fetched.</p>
  
  <pre><code>// PSEUDO CODE
  // Here the main query
  $q = $sql7-&gt;query("SELECT TOP 5 * FROM News ORDER BY Data Desc");
  while ($row = $q-&gt;fetch(PDO::FETCH_ASSOC)) {
      // Looping through the results
      echo "&lt;h1&gt;Main query&lt;/h1&gt;";
      print_r($row);
  
      // Issue a query on the same pdo connection
      $subq = $sql7-&gt;query("SELECT TOP 1 * FROM News WHERE IDNews = " . $row['IDNews'] . " ");
      while ($subResult = $subq-&gt;fetch(PDO::FETCH_ASSOC)) {
          echo "&lt;h1&gt;Inner query&lt;/h1&gt;";
          print_r($subResult);
      }
  
      // Here the main query $q-&gt;fetch(PDO::FETCH_ASSOC) will answer false on the next iteration
      // if we remove the subq, the main query loops just fine
      echo "&lt;hr&gt;";
  }
  </code></pre>
  
  <p>Same code on a Windows PHP with pdo_sqlserver driver works just fine.</p>
  
  <p>It doesn't matter the type of fetch that we pass as argument of fetch function.</p>
  
  <p>PHP doesn't throw any warning or error.</p>
  
  <p>I really don't know what's going on here.</p>