FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » fatal error: cannot redeclare
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: fatal error: cannot redeclare [message #171905 is a reply to message #171903] Thu, 20 January 2011 18:59 Go to previous messageGo to previous message
sheldonlg is currently offline  sheldonlg
Messages: 166
Registered: September 2010
Karma:
Senior Member
On 1/20/2011 1:14 PM, Jerry Stuckle wrote:
> On 1/20/2011 12:38 PM, Jivanmukta wrote:
>> Hello,
>> I have fatal error "Cannot redeclare openDatabase()". My script starts
>> with:
>>
>> <?php
>> require_once 'include/common.inc.php';
>> require_once 'include/functions.inc.php';
>> require_once 'include/database.inc.php';
>> require_once 'include/announcement.inc.php';
>> require_once 'include/Captcha.php';
>> if ($_SERVER['REQUEST_METHOD'] != 'POST') {
>> error(ERRMSG_POST_ALLOWED_ONLY);
>> }
>> sessionBegin();
>> savePostInSession();
>> if (!openDatabase()) {
>> error(ERRMSG_DATABASE_ACCESS_PROBLEM);
>> }
>>
>> where database.inc.php contains single definition of openDatabase():
>>
> <rest of code snipped>
>
> Either you've got another definition of openDatabase() somewhere and
> don't realize it, or you are including (or requiring) database.inc.php
> in one of your include files, probably without _once.
>

I never thought about this before, butnow that it came up, would it make
a difference if the database.inc.php was included in another included
file before this line

"require_once 'include/database.inc.php';"

or after (without a _once_). I would think that if it were included
first without a _once, then this current line would not be included
because it has a _once. If it occurs after this line, then it would be
doubly included because this line would be the first to include it.

If what I say is correct, then I would look in the code after this line.

What say you guys about my question?

--
Shelly
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: getting file from <option>
Next Topic: ElephantMark - a new simple tool for PHP documentation
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 21:05:35 GMT 2024

Total time taken to generate the page: 0.04292 seconds