php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #30916 odbc_fetch_array function only return associative array
Submitted: 2004-11-27 05:26 UTC Modified: 2016-08-12 12:16 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: halla at laptopinformation dot com Assigned: cmb (profile)
Status: Wont fix Package: ODBC related
PHP Version: 5.0.2 OS: WinXP
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: halla at laptopinformation dot com
New email:
PHP Version: OS:

 

 [2004-11-27 05:26 UTC] halla at laptopinformation dot com
Description:
------------
Hello,

The other x_fetch_array functions you provide return an associative AND numeric array.

We are are trying to port our code to odbc_fetch_array (from sqlite_fetch_array and mysql_fetch_array) and the code has mixed numeric and associative references.

Because of the mixture we cannot use the odbc_fetch_array function, as any returned arrays that are dependent on numeric  arrays fail.

Why is this not a consistent function, and is there a workaround ?


Is there a way to have the fetch_array function return a $row array for odbc with a numeric and associative index.


Reproduce code:
---------------
We have a class for each database called xxxxDatabase where xxxx = sqlite, mysql or odbc.

This is the fetch_array function;

function fetch_array($result) {

$row = odbc_fetch_array($result);

return $row

}

This only returns an associative array.

function fetch_array($result) {

$row = mysql_fetch_array($result);

return $row

}

This return an associative and numeric array



Expected result:
----------------
To get an array that contains associative AND numeric indexes

Actual result:
--------------
Associative only - not consistent with other database fetch array functions

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-01-01 23:42 UTC] jani@php.net
-Package: Feature/Change Request +Package: ODBC related
 [2016-08-12 12:16 UTC] cmb@php.net
-Status: Open +Status: Wont fix -Assigned To: +Assigned To: cmb
 [2016-08-12 12:16 UTC] cmb@php.net
This won't be implemented; use PDO for consistent behavior
across databases, or use the simple workaround:

  array_values($row) + $row
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 14:01:32 2024 UTC