Page 2 of 2
Re: failed to open stream Error
Posted: Thu Aug 06, 2009 2:53 pm
by jackpf
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().
Re: failed to open stream Error
Posted: Fri Aug 07, 2009 12:46 am
by pathfinder
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,
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 6
Re: failed to open stream Error
Posted: Fri Aug 07, 2009 8:12 am
by jackpf
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.
Re: failed to open stream Error
Posted: Fri Aug 07, 2009 8:34 am
by pathfinder
Hi
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
Posted: Fri Aug 07, 2009 9:09 am
by jackpf
You need to look through your code.
Re: failed to open stream Error
Posted: Fri Aug 07, 2009 3:10 pm
by superdezign
An alternative is to use the include_once() directive instead of include().
Always use include_once() when including files with class definitions.
Re: failed to open stream Error
Posted: Sun Aug 09, 2009 10:40 am
by jackpf
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
