From:             willy at vuboys dot nl
Operating system: Windows XP SP1
PHP version:      4.3.4
PHP Bug Type:     MSSQL related
Bug description:  Queries fail after sp_help

Description:
------------
After you run mssql_query("sp_help") all following queries fail. I am
using PHP4.3.4 running as ISAPI module in IIS5 on Windows XP. SQL Server
2000, version 8.00.760.

When you uncomment both lines in the reproduce script:
while (mssql_next_result($result));
mssql_free_result($result);

the script does work.


Reproduce code:
---------------
if ( ! $connect_id = mssql_connect( $sql_host,$sql_user,$sql_pass ) )
{
        die("Could not create a MSSQL connection, please check the SQL values
entered");
}
        
if ( ! mssql_select_db($sql_database, $connect_id) )
{
        die("MSSQL could not locate a database called '{$VARS['sql_database']}'
please check the value entered for this");
}

$result = mssql_query("SELECT @@VERSION");
$row = mssql_fetch_row($result);
echo $row[0]."<br />";

$result = mssql_query("sp_help", $connect_id);
while ($table = mssql_fetch_array($result))
{
        if (($table[2]=="user table") && (!($table[0]=="dtproperties"))) {
                echo $table[2]." | ".$table[0]."<br />";
        }
}
// while (mssql_next_result($result));
// mssql_free_result($result);

$result = mssql_query("SELECT @@VERSION");
$row = mssql_fetch_row($result);
echo $row[0]."<br />";
mssql_close($connect_id);       
?>

Expected result:
----------------
Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation Personal Edition on Windows
NT 5.1 (Build 2600: Service Pack 1) 
user table | table 1
...
user table | table n
Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation Personal Edition on Windows
NT 5.1 (Build 2600: Service Pack 1) 


Actual result:
--------------
Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation Personal Edition on Windows
NT 5.1 (Build 2600: Service Pack 1) 
user table | table 1
...
user table | table n

Warning: mssql_query(): Query failed in c:\inetpub\wwwroot\testsql.php on
line 33


-- 
Edit bug report at http://bugs.php.net/?id=27204&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=27204&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=27204&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=27204&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=27204&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=27204&r=needtrace
Need Reproduce Script:      http://bugs.php.net/fix.php?id=27204&r=needscript
Try newer version:          http://bugs.php.net/fix.php?id=27204&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=27204&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=27204&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=27204&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=27204&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=27204&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=27204&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=27204&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=27204&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=27204&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=27204&r=float

Reply via email to