好的,所以我们有了一台新的服务器
这个PHP应用程序需要与旧的SQL Server 2000服务器通信.我们使用了以前服务器中的旧代码(PHP 5.2和更旧的FreeTDS - 无法获得该版本).我们使用dblib驱动程序通过PDO连接到SQL Server 2000.
我们在使用fetch函数时会遇到奇怪的行为.基本上,如果我们在同一个pdo连接对象的fetch循环期间发出查询,则主查询将被重置,即使仍有要提取的记录,下一个fetch调用也将返回false.
// PSEUDO CODE
// Here the main query
$q = $sql7->query("SELECT TOP 5 * FROM News ORDER BY Data Desc");
while ($row = $q->fetch(PDO::FETCH_ASSOC)) {
// Looping through the results
echo "<h1>Main query</h1>";
print_r($row);
// Issue a query on the same pdo connection
$subq = $sql7->query("SELECT TOP 1 * FROM News WHERE IDNews = " . $row['IDNews'] . " ");
while ($subResult = …Run Code Online (Sandbox Code Playgroud)