hello.
i'm using php + odbc to retrive data from a bd, i have made a function called "my_odbc_fetch_array()" that works similar as mysql_fetch_array(), this function is in a .inc file.
the problem is that i keep getting "Cannot redeclare my_odbc_fetch_array() (previously declared in conf.inc) in every script that i include conf.inc.
i'm really frustated with this, even more when everything works well at home(i have xampp installed) and when i install the scripts at other place they doesn't work(i get this errors).
thanks
help: cannot redeclare function
Moderator: General Moderators
-
mcog_esteban
- Forum Contributor
- Posts: 127
- Joined: Tue Dec 30, 2003 3:28 pm
-
LostMyLove
- Forum Newbie
- Posts: 20
- Joined: Mon Sep 27, 2004 12:20 pm
did u don't putting 2 times this function?
or including the file two times...
example:
index.php
sub.php
? if yes, is that the problem, let u delete the include os the sub.php ...
and try using include_once() if error persists
or including the file two times...
example:
index.php
Code: Select all
include('*.inc");
include('sub.php');Code: Select all
include('*.inc');and try using include_once() if error persists
well, you can wrap your function in if(!function_exists(...)) block:
Code: Select all
//........
if( !function_exists('my_odbc_fetch_array') ) {
function my_odbc_fetch_array() {
// function body here
}
}
// ........-
mcog_esteban
- Forum Contributor
- Posts: 127
- Joined: Tue Dec 30, 2003 3:28 pm
-
mcog_esteban
- Forum Contributor
- Posts: 127
- Joined: Tue Dec 30, 2003 3:28 pm
-
mcog_esteban
- Forum Contributor
- Posts: 127
- Joined: Tue Dec 30, 2003 3:28 pm