Are you including the file twice?
Put "echo 'included';" or something in database.php, and see how many times it's output.
If you really can't find it, try using include_once() instead of include().
failed to open stream Error
Moderator: General Moderators
-
pathfinder
- Forum Newbie
- Posts: 10
- Joined: Thu Aug 06, 2009 7:14 am
Re: failed to open stream Error
Hi
When echoing included, it return two times
And when I am use
function MySQLDatabase()
{ echo MySQLDatabase();
} to find the location (may be i am wrong...) of declaration it returns,
When echoing included, it return two times
Code: Select all
Include
Include
function MySQLDatabase()
{ echo MySQLDatabase();
} to find the location (may be i am wrong...) of declaration it returns,
Code: Select all
Fatal error: Cannot redeclare mysqldatabase() (previously declared in J:\wamp\www\photo_gallery\includes\database.php:5) in J:\wamp\www\photo_gallery\includes\database.php on line 6Re: failed to open stream Error
Then you're including it twice. You should only include it once. Find where you're including it the second time, and remove that code.
-
pathfinder
- Forum Newbie
- Posts: 10
- Joined: Thu Aug 06, 2009 7:14 am
Re: failed to open stream Error
Hi
will u tell me how to find second "include"
any function of procedure...........
other wise i will manually find....
will u tell me how to find second "include"
any function of procedure...........
other wise i will manually find....
Re: failed to open stream Error
You need to look through your code.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Re: failed to open stream Error
An alternative is to use the include_once() directive instead of include().
Always use include_once() when including files with class definitions.
Always use include_once() when including files with class definitions.
Re: failed to open stream Error
Well...if the include is in a function which is called multiple times then yeah....
But it seems as though the OP is including the file twice accidentally. That's just....bad code, and shouldn't be covered up with include_once(). He should find out where the extra unneeded include is and remove it.
Besides, include_once() is slower than include(). Not that you could even tell...but that's what I've heard
But it seems as though the OP is including the file twice accidentally. That's just....bad code, and shouldn't be covered up with include_once(). He should find out where the extra unneeded include is and remove it.
Besides, include_once() is slower than include(). Not that you could even tell...but that's what I've heard