php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30322 mssql_fetch_field(result)->column_source same as ->name
Submitted: 2004-10-04 16:22 UTC Modified: 2004-10-05 09:34 UTC
From: erik at xpand dot nl Assigned:
Status: Not a bug Package: MSSQL related
PHP Version: 5.0.2 OS: Windows Server 2003
Private report: No CVE-ID: None
 [2004-10-04 16:22 UTC] erik at xpand dot nl
Description:
------------
I executed this query with 2 columns which have the same name:
SELECT tbl1.n_MatchID, tbl2.n_MatchID FROM tbl1,tbl2 WHERE (etc)

When I request the fields, the column_source and the name are the same...

Reproduce code:
---------------
$query = "SELECT Infostrada.tFootballMatch.n_MatchID as a, Infostrada.tFootballMatchDetail.n_MatchID as b FROM Infostrada.tFootballMatchDetail, Infostrada.tFootballMatch WHERE Infostrada.tFootballMatch.n_MatchID = Infostrada.tFootballMatchDetail.n_MatchID";
$result = mssql_query($query) or die();

while($obj = mssql_fetch_field($result)) {
	echo $obj->column_source . "." . $obj->name . "<br>";
}

Expected result:
----------------
tFootballMatch.n_MatchID<br>
tFootballMatchDetail.n_MatchID<br>

($obj->column_source.$obj->name)

Actual result:
--------------
n_MatchID.n_MatchID<br>
n_MatchID.n_MatchID<br>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-04 22:34 UTC] iliaa@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

The data you are seeing is returned directly from mssql library without any modifications. So, the bug (valid bug btw) is not a PHP one, but a bug in the mssql library you are using.
 [2004-10-05 08:44 UTC] erik at xpand dot nl
It wasn't a support request. I was sure it is a bug, but I didn't realize it could be a bug in the mssql-lib.

Thanks for your reply
 [2004-10-05 09:34 UTC] derick@php.net
No bug in PHP -> bogus.
 [2012-01-04 08:25 UTC] jochem dot blok at fasterforward dot nl
The described result is the samen on Linux Debian. The driver (FreeTDS) is different then the Windows driver. Are you sure this is not a bug in PHP?

(Yes I have seen this bug is 8 years old ;))
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 09:01:28 2024 UTC