note 89506 deleted from function.mssql-query by cmb
| From: | cmb@php.net | Date: | Sun, 23 Jun 2019 14:18:43 +0000 |
| Subject: | note 89506 deleted from function.mssql-query by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211360@lists.php.net to get a copy of this message | ||
Note Submitter: sergio dot charrua at gmail dot com
----
hello all!
here's a tip for those of you that, just like me, had some problems on how to get values from a
call to a Stored Procedure that returns Multiple Recordsets.
<?php
conn = mssql_connect($server, $user, $pass, $db);
$sql ="EXEC WhateverSProcYouWant some_arguments";
$data = mssql_query( $sql, $conn);
$result = array();
do {
while ($row = mssql_fetch_object($data)){
$result[] = $row;
}
}while ( mssql_next_result($data) );
mssql_close($conn);
?>
this will create 2 loops:
1 - which loops through all returned recordsets. mssql_next_result will step through each recordsets
2 - this inner-loop will return all rows, as objects, from current recordset and add each object to
the $result array.
and that's it!
HTH, has i haven't found any info/docs related to multiple recordsets