php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37708 no functionable named mssql-connection and including files
Submitted: 2006-06-06 07:24 UTC Modified: 2006-06-06 08:17 UTC
From: frank dot neitzel at volkswagen dot de Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.1.4 OS: Windows 2003
Private report: No CVE-ID: None
 [2006-06-06 07:24 UTC] frank dot neitzel at volkswagen dot de
Description:
------------
If I have to include a file per "require_once", the mssql-functions will get an own life.

-- Life 1 --
#require_once("xxx.php");
$con4 = mssql_connect (....);
mssql_select_db (..., $con4);
...
->
    [Field1] => ...
    [Field2] => ...

-- Life 2 --
require_once("xxx.php");
$con4 = mssql_connect (....);
mssql_select_db (..., $con4);
...
->
    [1] => ...
    [2] => ...

-- so should it be and will work --
mssql_connect (....);
mssql_select_db (...);
...
->

    [1] => ...
    [Field1] => ...
    [2] => ...
    [Field2] => ...


Reproduce code:
---------------
<pre><?

#require_once("xxx.php");


 // named db-connection
 $con4 = mssql_connect ("db-intranet.han.vw.vwg", "xxx", "xxx");
 mssql_select_db ("VWN_Redax", $con4);
 $rst = mssql_query("exec vwn_redax.dbo.sp_get_groups_to_user @u_authuser = 'devwag00\\eneitze'", $con4);
 $tblUsers = mssql_fetch_array($rst, $con4);
 print_r($tblUsers);

 // unnamed db-connection
 mssql_connect ("db-intranet.han.vw.vwg", "xxx", "xxx");
 mssql_select_db ("VWN_Redax");
 $rst = mssql_query("exec vwn_redax.dbo.sp_get_groups_to_user @u_authuser = 'devwag00\\eneitze'");
 $tblUsers = mssql_fetch_array($rst);
 print_r($tblUsers);


?></pre>

Expected result:
----------------
    [0] => 1
    [tblRolesId] => 1
    [1] => Mitglied
    [tblRolesTitle] => Mitglied
    [2] => 3105
    [tblGroupsId] => 3105
    [3] => 2-C-1 FiSi Admin
    [tblGroupsTitle] => 2-C-1 FiSi Admin


Actual result:
--------------
    [0] => 1
    [1] => Mitglied
    [2] => 3105
    [3] => 2-C-1 FiSi Admin

or

    [tblRolesId] => 1
    [tblRolesTitle] => Mitglied
    [tblGroupsId] => 3105

... depends on including a file or not.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-06-06 08:10 UTC] frank dot neitzel at volkswagen dot de
Usererror:

Mistake is here: mssql_fetch_array($rst, $con4);

... no ConnectionId ... *uuh, oh*

regards,
Frank Neitzel
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC