Capturing multiple query results from one Sybase Proc
Posted: Thu Oct 26, 2006 5:25 pm
I have several Sybase stored procedures that return either a result set and return status or multiple results from multiple queries. I am faced with a weird situation and was hoping that someone here has dealt with this before. Google is not my friend today and the Sybase docs, well, they are a bit lacking.
I have found information on the web that leads me to believe that PHP cannot handle multiple result sets returned from queries or procs. I tested this buy sending a direct call to the database like this...
On any call that returns more than one result set, I get this...
With debugging on, I get this return
Which is the first of the two queries. So what it looks like is happening is PHP is calling the database up, sending it the query, grabbing the first result and running with it while the database server still has things to process. So my question is, has anyone had any experience in fetching multiple result sets from Sybase/SQL Server with PHP? Does anyone know of any resources available to this if not? All help is much appreciated.
I have found information on the web that leads me to believe that PHP cannot handle multiple result sets returned from queries or procs. I tested this buy sending a direct call to the database like this...
Code: Select all
<?php
$sql = "select getdate() select datediff (yy, \"1984\", \"1997\") go";
if (!$qry = mssql_query($sql))
{
die('Error in query: ' . mssql_get_last_message());
}
if ($debug)
{
echo '<pre>';
var_dump(mssql_fetch_assoc($qry));
echo '</pre>';
}
?>Code: Select all
[b]Notice:[/b] sybase_query(): Sybase: Unexpected results, cancelling current in [b]/path/to/my/file/test_sybase_2.php[/b] on line [b]28[/b]Code: Select all
array(1) {
["computed"]=>
string(19) "Oct 26 2006 1:58PM"
}