note 81957 added to function.odbc-fetch-array
| From: | bryantatzionprogrammingdotcom at osu1 dot php dot net | Date: | Thu, 20 Mar 2008 23:04:55 +0000 |
| Subject: | note 81957 added to function.odbc-fetch-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-137251@lists.php.net to get a copy of this message | ||
I found the function submitted by jezndiatyahoodotcodotuk to be very helpful. I'm using PHP
5.2.5 and this function isn't defined, so it may depend on the ODBC driver being used.
The only problem with the solution already posted is that the return values don't match the
ones specified by the documentation. I made the following modification so that the function will
work the same whether it exists internally or not:
<?php
if (!function_exists('odbc_fetch_array')) {
function odbc_fetch_array($result, $rownumber=null) {
$array = array();
if (!($cols = odbc_fetch_into($result, $result_array, $rownumber))) {
return false;
}
for ($i = 1; $i <= $cols; $i++) {
$array[odbc_field_name($result, $i)] = $result_array[$i - 1];
}
return $array;
}
}
?>
----
Server IP: 208.69.120.35
Probable Submitter: 209.63.19.210
----
Manual Page -- http://www.php.net/manual/en/function.odbc-fetch-array.php
Edit -- https://master.php.net/note/edit/81957
Del: integrated -- https://master.php.net/note/delete/81957/integrated
Del: useless -- https://master.php.net/note/delete/81957/useless
Del: bad code -- https://master.php.net/note/delete/81957/bad+code
Del: spam -- https://master.php.net/note/delete/81957/spam
Del: non-english -- https://master.php.net/note/delete/81957/non-english
Del: in docs -- https://master.php.net/note/delete/81957/in+docs
Del: other reasons-- https://master.php.net/note/delete/81957
Reject -- https://master.php.net/note/reject/81957
Search -- https://master.php.net/manage/user-notes.php