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
Have you experienced this issue?
Rate the importance of this bug to you:

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2022 The PHP Group
All rights reserved.
Last updated: Sun Aug 14 19:05:46 2022 UTC