|  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
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: halla at laptopinformation dot com
New email:
PHP Version: OS:


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

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


Add a Patch

Pull Requests

Add a Pull Request


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

  array_values($row) + $row
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sun Sep 24 15:01:24 2023 UTC