ID: 17593 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: MSSQL related Operating System: Win2k prof. SP2 PHP Version: 4.2.1 New Comment:
In PHP 4.3.0 you will be able to fix this problem by calling mssql_free_result($r1); after the first statement. When you use if statements MSSQL server seams to hold the result (blocing for other statements) until the result is released. Previous Comments: ------------------------------------------------------------------------ [2002-06-04 06:38:50] [EMAIL PROTECTED] It seems that mssql_query fails to get results properly after executing some arbitrary queries. <?php mssql_connect(".","login","passwd"); $r1=mssql_query("if object_id('tempdb..#abc') is not null drop table #abc"); $r2=mssql_query("select * from sometable"); $r3=mssql_query("select * from othertable"); ?> ..causes.. Warning: MS SQL error: Attempt to initiate a new SQL Server operation with results pending. (severity 7) in d:\htdocs\t\bug.php on line 4 Warning: MS SQL: Query failed in d:\htdocs\t\bug.php on line 4 Warning: MS SQL error: Attempt to initiate a new SQL Server operation with results pending. (severity 7) in d:\htdocs\t\bug.php on line 5 Warning: MS SQL: Query failed in d:\htdocs\t\bug.php on line 5 ---- First query is correct and executes properly (checked with SQL server profiler running). But 2nd,3rd..n-th fail to execute. Though if I comment out 1st one, others work ok. Another dirty hack to avoid these errors is to embed entire query in exec(""). But then temporary #tables won't be available in next queries. I've found another similar bug in database, #9379. Using sql variables in query causes same weird behaviour... In a few days I will test this script on Linux/apache/php/freedts connecting to same sql database and see if it works. Any ideas? ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17593&edit=1