Using require_once then require

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mediatagging
Forum Newbie
Posts: 3
Joined: Wed Nov 11, 2009 1:53 am

Using require_once then require

Post by mediatagging »

I have two files A & B.

All the files are linked. In file A, I have require_once(filename.php). In file B i have require(filename.php). For some reason this causes some conflict when running the code. There is code in File A that usually runs, but doesnt when the above is the case. Any idea why? Thanks.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Using require_once then require

Post by requinix »

And what's in filename.php?
mediatagging
Forum Newbie
Posts: 3
Joined: Wed Nov 11, 2009 1:53 am

Re: Using require_once then require

Post by mediatagging »

Filename.php just has a function. A blank function that doesn't get called. It definitely has something to do with the requires because once I commented out the first one everythig worked fine.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Using require_once then require

Post by requinix »

Can't define a function twice. One file included filename.php, then another. That second time caused PHP to halt.

Use require_once.
Post Reply