# PHP problem

**URL:** <https://forum.kirupa.com/t/php-problem/140235>\
**Category:** Uncategorized\
**Created:** [March 9, 2005, 11:09am UTC](https://forum.kirupa.com/t/php-problem/140235 "2005-03-09T11:09:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Collymore](https://avatars.discourse-cdn.com/v4/letter/c/ec9cab/32.png) [@Collymore](https://forum.kirupa.com/u/Collymore)\
**Post date:** [March 9, 2005, 11:09am UTC](https://forum.kirupa.com/t/php-problem/140235/1 "2005-03-09T11:09:08Z")

</div>

I keep getting this error message:

" **Fatal error** : Cannot redeclare odbc\_fetch\_array() in **D:\intranet\Laptop\odbc\_DitDB.php** on line **25"**

when I try and connect to a database.

I wrote the ditDB.php (below) in version 4.1 but the server i’m using now “nt 2003” is using the latest version 5.1.2 I think. Is there something different I need to add for the latest version?

\<?  
$odbc = odbc\_connect (‘DitDB’, ‘’, ‘’) or die( “Could Not Connect to ODBC Database!”);  
if (function\_exists(odbc\_fetch\_array))  
return;  
function odbc\_fetch\_array($result, $rownumber=-1) {  
if (PHP\_VERSION \> “4.1”) {  
if ($rownumber \< 0) {  
odbc\_fetch\_into($result, $rs);  
} else {  
odbc\_fetch\_into($result, $rs, $rownumber);  
}  
} else {  
odbc\_fetch\_into($result, $rownumber, $rs);  
}

$rs\_assoc = Array();  
foreach ($rs as $key =\> $value) {  
$rs\_assoc[odbc\_field\_name($result, $key+1)] = $value;  
}  
return $rs\_assoc;  
}  
?\>
