ODBC Function equivalent to MySql_Fetch_Array

From: Date: Wed, 11 Jul 2001 05:23:08 +0000
Subject: ODBC Function equivalent to MySql_Fetch_Array
Groups: php.general 
Request: Send a blank email to php-general+get-57306@lists.php.net to get a copy of this message
Hi, I'm trying to write a function (see below) that will provide equivalent functionality between ODBC and MySQL for mysql_fetch_array based upon a preset variable. I've written something that works but A) I'm afraid it might be quite slow; and B) I'm hoping that there is an existing function to do it that I just didn't see! If there isn't an existing function ... how do I go about requesting it for a future release? One of the key things I was looking for was the field names in the associative array (Note: I already had ... and commented out ... the odbc_fetch_into function ... nice but not quite what I was wanting) Thanks. --------------------------------- function db_fetch_array($result) { global $db_type, $db_connection; if ($db_type == 1) : return mysql_fetch_array($result); else: $i = 0; $fCount = odbc_num_fields($result); $result_array = array(); if (odbc_fetch_row($result)) : while ($i < $fCount) $i++; $fName = odbc_field_name($result, $i); $result_array[$fName] = odbc_result($result, $i); } // odbc_fetch_into ($conn, &$result_array); return $result_array; else: return false; endif; endif;

« previous php.general (#57306) next »