[PHPwestoz] problem with includes

Gnitnop G gnitnop at ymail.com
Mon Feb 22 16:30:34 EST 2010


 
Hi All!
 
I seem to be having a problem with php includes. sketching out my problem with an example will look something like this:
 
I have 3 main php pages A.php, B.php and C.php.
I have 3 include files; (1) dbconnect.php, (2) login1.php (3) login2.php
 
All main pages; A.php, B.php and C.php includes (1) & (2) in their own page
login1.php includes (3)
login2.php AGAIN includes (1) - (for its local database service)
 
Basically, in a nutshell, what I'm trying to achieve here is for a user to be able to login from any main page; i.e. A,B or C; and login1.php has the form that gets included in these pages, apart from these pages already including dbconnect.php. 
login1.php then includes login2.php which also includes dbconnect.php for its own use.
 
So the problem I'm having here is I get the following error when I try to login from any of the 3 main pages:
 
[Mon Feb 22 12:06:40 2010] [error] [client 127.0.0.1] PHP Fatal error:  Cannot redeclare dbconnect() (previously declared in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\xxxxxxx\\includes\\dbconnect.php:2) in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\xxxxxxx\\includes\\dbconnect.php on line 22, referer: http://localhost/xxxxxxx/A.php 
 
I get the same error when clicking from AB or C. Only the referer page in the trace changes and the rest are all the same each time.
 
Then, I tried include_once for all .php's but then I run into empty for-each'es as one below:
 
[Mon Feb 22 12:26:49 2010] [error] [client 127.0.0.1] PHP Warning:  Invalid argument supplied for foreach() in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\kookaburraartgallery\\journal_pdo.php on line 31, referer: http://localhost/xxxxxxxx/B.php
 
Can someone help me with this maze, plz.
 
thanks
greymatter
 
 
 
 


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.linux.org.au/pipermail/phpwestoz/attachments/20100222/121ad2dc/attachment.htm 


More information about the PHPwestoz mailing list