|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-09-12 04:03 UTC] pvy at novosoft dot ru
Hello!
I create next procedure in MSSQL 7.0:
CREATE PROCEDURE z_test AS
begin
select 1
select 2
select 3
return 2003
end
then I wrote next script:
<?php
error_reporting(32767);
mssql_connect ( '***', '*****','******' );
mssql_select_db('my_db');
for ($i=1; $i<5; $i++) {
$stmt=mssql_init("z_test");
$result=mssql_execute($stmt);
mssql_free_result($result);
}
?>
and got next answer from php:
Warning: mssql_execute: multiple recordsets from a stored procedure not supported yet! (Skipping...) in D:\project
s\eve\htdocs\mssql.php on line 9
Warning: MS SQL: stored procedure execution failed. in D:\projects\eve\htdocs\mssql.php on line 9
Warning: mssql_free_result(): supplied argument is not a valid MS SQL-result resource in D:\projects\eve\htdocs\mss
ql.php on line 9
Warning: MS SQL: unable to init stored procedure in D:\projects\eve\htdocs\mssql.php on line 9
Warning: mssql_execute(): supplied argument is not a valid MS SQL-Statement resource in D:\projects\eve\htdocs\mssq
l.php on line 9
Warning: mssql_free_result(): supplied argument is not a valid MS SQL-result resource in D:\projects\eve\htdocs\mss
ql.php on line 9
Warning: MS SQL: unable to init stored procedure in D:\projects\eve\htdocs\mssql.php on line 9
Warning: mssql_execute(): supplied argument is not a valid MS SQL-Statement resource in D:\projects\eve\htdocs\mssq
l.php</b> on line 9
Warning: mssql_free_result(): supplied argument is not a valid MS SQL-result resource in D:\projects\eve\htdocs\mss
ql.php on line 9
As I understand this log - first time _execute function get normal result resource but in next we see "unable to init" error.
How I can clear old result set for prevent these errors?
and also, how I can get number in 'return' string?
Thanks in advise,
Vladimir.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 11:00:01 2025 UTC |
In PHP 4.3.0 this will be changed so multiple results are allowd in storred procedures. The code to access both results and return values would look like this: $stmt=mssql_init("z_test"); mssql_bind($stmt, "RETVAL", &$retval, SQLINT4); $result=mssql_execute($stmt); do { while ($row = mssql_fetch_assoc($result)) print_r($row); } while (mssql_next_result($result)); print($retval); mssql_free_result($result);