|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-01-30 09:23 UTC] manal at free dot fr
Description:
------------
The script below should return one row, but it doesn't.
The same queries executed by mssql_query work fine.
Test script:
---------------
<?php
$db = new PDO('dblib:host=myhost;dbname=master','user','password');
$query = "declare @myInt int = 1; select @myInt;";
$stmt = $db->query($query);
$rows = $stmt->fetchAll();
print_r($rows);
?>
Expected result:
----------------
Array
(
[0] => Array
(
[computed] => 1
[0] => 1
)
)
Actual result:
--------------
Array
(
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 22:00:02 2025 UTC |
You can also skip rowsets that don't actually return results by doing this check in a loop : do { if ($stmt->columnCount() > 0) { //This statement is returnings rows, fetch them $result = $stmt->fetchAll(); } else { // This statement does not return rows, skip it } } while ($stmt->nextRowset());