php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #49846 function.odbc-field-name does not respect the AS function in a SELECT statement
Submitted: 2009-10-12 16:16 UTC Modified: 2009-11-13 21:01 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kareemhamdy at gmail dot com Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 5.3.0 OS: Ubuntu
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: kareemhamdy at gmail dot com
New email:
PHP Version: OS:

 

 [2009-10-12 16:16 UTC] kareemhamdy at gmail dot com
Description:
------------
function.odbc-field-name does not respect the AS function in a SELECT statement shown below:

$query_db_CDR = "SELECT	tbl_EM_Matrix.hostname as vru from ..."

The result, returns 'hostname', instead of 'vru'.

Reproduce code:
---------------
---
From manual page: function.odbc-field-name
---

function odbc_fetch_assoc($result){
	if (odbc_fetch_row($result)) {
		$return_array=array();
		$max_result=odbc_num_fields($result);
	
		for ($counter=1;$counter<=$max_result;$counter++){
			$return_array[odbc_field_name($result, $counter)] = odbc_result($result, $counter);
		}
				
		return $return_array; 		
	}
}

Expected result:
----------------
Using the select statement from above, I should be able to print_r (odbc_fetch_assoc($result)), and see 'vru'.  Instead, I see 'hostname'.  The function does not respect the "as" function.

Array ([hostname]=>)

Actual result:
--------------
Array ([vru]=>)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-11-13 21:01 UTC] vrana@php.net
The description clearly states that the function returns columnname, not the alias.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Jun 16 11:00:01 2026 UTC