Bug #34784 [Asn->Opn]: Changed database context error when SELECT > 33 columns

From: Date: Mon, 29 Dec 2014 01:04:26 +0000
Subject: Bug #34784 [Asn->Opn]: Changed database context error when SELECT > 33 columns
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189281@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=34784&edit=1

 ID:                 34784
 Updated by:         kalle@php.net
 Reported by:        jwall at webpeak dot com
 Summary:            Changed database context error when SELECT > 33
                     columns
-Status:             Assigned
+Status:             Open
 Type:               Bug
 Package:            MSSQL related
 Operating System:   Windows XP
 PHP Version:        5CVS-2005-10-08 (snap)
-Assigned To:        fmk
+Assigned To:        
 Block user comment: N
 Private report:     N



Previous Comments:
------------------------------------------------------------------------
[2011-03-07 19:28:36] esflores at gmail dot com

Same problem but I found a valid solution to SP cases
Problem:
$proc = mssql_init("SP_Test");
mssql_bind($proc,"@var1",$_POST['var1'],SQLVARCHAR);
mssql_bind($proc,"@var2",$_POST['var2'],SQLVARCHAR);
$res = mssql_execute($proc) or die("ERROR: ".mssql_get_last_message());
//Output: Changed database context to 'DBNAME'

Solution:
$res = mssql_query("EXEC SP_Test
'".$_POST['var1']."','".$_POST['var2']."'");

------------------------------------------------------------------------
[2011-02-05 19:19:20] nkrsaxena at gmail dot com

This Bug is driving me crazy man, I am using
RHEL 5
Apache 2.0 server handler
Mysql 5.0
And trying to install PHP5.3.5 
installed all necessary file, now i use to connect to MSSQL server, my script 
shows
DB connected
DB selected

while performing Query it return "Changed database context XXXXXXX"
i have checked the same query on below two and running perfect
1. MSSQL terminal running file
2. Ran same script with all settings except PHP version 4.3.2 and 5.1.6

I tried the with RPM's as well but no luck. Googled a lot but no solution for 
the same.

------------------------------------------------------------------------
[2009-12-04 20:59:39] chrisgenrich at bmminvestments dot com

I was getting this error with a long running query and modified the php.ini to the following:

; Minimum error severity to display.
mssql.min_error_severity = 0

; Minimum message severity to display.
mssql.min_message_severity = 17


It's possible that lower settings could work as well...

------------------------------------------------------------------------
[2009-03-10 14:00:48] markus_hay at quantumdigital dot com

This bug has not been fixed and it's driving me absolutely nuts as I can not seem to reproduce
it in a non-production environment to find a workaround. It happens on UPDATEs, INSERTs, SELECTs,
etc., and it's completely random.

I don't know if it's a PHP issue or a PEAR issue, but as of PHP 5.2.5 and PEAR 1.7.2 the
so-called informative message of "Changed database context to ..." is still appearing. OS
is Windows Server 2k3 and database is MS SQL Server 2005.


The following settings are used in php.ini:
===========================================
mssql.min_error_severity = 10
mssql.min_message_severity = 10


Here is some example code:
==========================
$sSql = 'UPDATE Table SET iNumber = 5 WHERE iRecordId = 666';
if (PEAR::isError($oResults = $rDbConn->query($sSql))) {
     die($oResults->getMessage());
}


Typical output would be:
========================
[Native code: 0]
[Native message: Changed database context to 'TableName'.]


Is this ever going to get fixed?

------------------------------------------------------------------------
[2008-03-06 18:45:55] arn_schw at yahoo dot com

Hi , 
I've written this code to use the data stored in the data-base named moviesite. The result is
supposed to print the names of three different movies each one time.But,I get each 51 times I
couldn't get where the error is present.So,please help me in rectifying my mistake......



<?php

//connecting to mysql
$connect = mysql_connect ( "localhost" , "root" , "") 
                   or die ( " You can't be connected to the server " ) ;
 
mysql_select_db (moviesite) ; 

$result = "SELECT movie_name , movie_year " . 
                "FROM movie " . 
                "WHERE movie_year > 1900 " . 
                "ORDER BY movie_name " ; 

$res = mysql_query ( $result ) 
                 or die ( mysql_error ( ) ) ; 


$st = 0 ; 

while( $ress = mysql_fetch_assoc ( $res ) )
{
 extract ( $ress ) ;
  echo "$movie_name" ; 
  echo "<br>" ; 
 $st = $st+1 ; 
}

echo "Finally the number of times it is printed is....".$st ; 

?>

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=34784


--
Edit this bug report at https://bugs.php.net/bug.php?id=34784&edit=1


Thread (18 messages)

« previous php.bugs (#189281) next »