note 89506 added to function.mssql-query

From: Date: Wed, 11 Mar 2009 14:53:14 +0000
Subject: note 89506 added to function.mssql-query
Groups: php.notes 
Request: Send a blank email to php-notes+get-151737@lists.php.net to get a copy of this message
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. 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 ---- Server IP: 194.8.30.16 Probable Submitter: 213.63.128.1 ---- Manual Page -- http://www.php.net/manual/en/function.mssql-query.php Edit -- https://master.php.net/note/edit/89506 Del: integrated -- https://master.php.net/note/delete/89506/integrated Del: useless -- https://master.php.net/note/delete/89506/useless Del: bad code -- https://master.php.net/note/delete/89506/bad+code Del: spam -- https://master.php.net/note/delete/89506/spam Del: non-english -- https://master.php.net/note/delete/89506/non-english Del: in docs -- https://master.php.net/note/delete/89506/in+docs Del: other reasons-- https://master.php.net/note/delete/89506 Reject -- https://master.php.net/note/reject/89506 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#151737) next »