Re: Problem: Sybase, PHP and multiple result sets

From: Date: Wed, 15 Aug 2001 07:18:46 +0000
Subject: Re: Problem: Sybase, PHP and multiple result sets
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-62784@lists.php.net to get a copy of this message
On Wednesday 15 August 2001 10:07, Warren Vail wrote: > The ability to select a set from a previously selected set is > possible in Sybase because the database supports creation of > temporary tables and the select insert. No, you seem to have missed my point entirely. So I'll explain in a little more detail. I run a stored procedure. Let's assume I run it from the interactive utility and not from PHP for the moment. > SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3 The database returns: foo bar === === 10 20 30 40 field1 field2 field3 ====== ====== ====== string bla 15 nothing bla 12 As you can see, it returns TWO result sets. One with two numeric columns. The next with three columns, the first two string and the last numeric. This is, of course, just an example. Now back to the web interface. If I use PHP, I get only the first result set. That is, I write something along the lines of: $rs = sybase_query( "SP_SOMETHING_OR_OTHER PARAM1 PARAM2 PARAM3", $conn ); while ( $row = sybase_fetch_row( $rs ) ) { echo $row[0]; // and so on } This will only display the results of the first result set - the one with the two fields, foo and bar. There is no way for me to reach the second table generated by the query. This is supposed to be the significant table. Now, in ASP, there is something like set rs = rs.NextResultSet Which sets the rs to the second result set, the one with the three fields of mixed types, at which point you loop, just like above, and retrieve the new information. This method or an equivalent of it is not in the PHP documented set of Sybase functions. I hope I made myself clearer. And by the way, you don't have to sell me on the uselessness of ASP, the general uselessness of Microsoft etc. - I don't use any Microsoft products, even at work. Herouth

« previous php.general (#62784) next »