ID: 27204
Updated by: [EMAIL PROTECTED]
Reported By: willy at vuboys dot nl
-Status: Open
+Status: Feedback
Bug Type: MSSQL related
Operating System: Windows XP SP1
PHP Version: 4CVS-2004-02-10
New Comment:
I don't know mssql at all..but what might that 'sp_help' query
supposedly do? (some url pointing to a document explaining it is
enough..) It sounds like something you're not allowed/supposed to do
from a script..
Previous Comments:
------------------------------------------------------------------------
[2004-02-10 06:23:35] willy at vuboys dot nl
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 this bug report at http://bugs.php.net/?id=27204&edit=1