[thelist] [php] cannot redeclare function error

David Bindel dbindel at austin.rr.com
Mon Feb 10 17:49:51 CST 2003


> > I am getting an error with one function :
> > "*Fatal error*: Cannot redeclare getuser() in */<file
> > path>/includes/databaseFunctions.php* on line *20*"
> > when databaseFunctions.php is included.
> > There are two possible errors that cause this error (that I know of)
> > (1) The function is being defined twice - this is not
> happening with
> > mine, as it only occurs *once* in all 4 files that the script
> > involves.
> > (2) It is a reseved built in function name for an already
> existing php
> > function - the function name i am using is "getUser()". I
> have scoured
> > the manual and have found no match.
> > The function does not call itself, which I thought could
> also cause the
> > error. Does anyone have any suggestions?
> >
> or (3)maybe the file is included more than once !
>
> check if you got some recursive includes (happened to me once!)
> (ie: the file is included in an other file too!)

You can use PHP's require_once() function instead of include() or
require() to prevent the inclusion of a page twice in a page.  If that
doesn't work, please send us the code your are using and we'll help you
from there.

HTH,
David Bindel




More information about the thelist mailing list