Ah I see it&#39;s time once again for the annual post to the mailing list :)<div><br></div><div>include_once should indeed work the situation you describe.</div><div><br></div><div>What was the code around line 31 of journal_pdo.php that was throwing the foreach error?<br>
<br><div class="gmail_quote">On 22 February 2010 13:30, Gnitnop G <span dir="ltr">&lt;<a href="mailto:gnitnop@ymail.com">gnitnop@ymail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<table cellspacing="0" cellpadding="0" border="0"><tbody><tr><td valign="top" style="font:inherit"><div> </div>
<div>Hi All!</div>
<div> </div>
<div>I seem to be having a problem with php includes. sketching out my problem with an example will look something like this:</div>
<div> </div>
<div>I have 3 main php pages A.php, B.php and C.php.</div>
<div>I have 3 include files; (1) dbconnect.php, (2) login1.php (3) login2.php</div>
<div> </div>
<div>All main pages; A.php, B.php and C.php includes (1) &amp; (2) in their own page</div>
<div>login1.php includes (3)</div>
<div>login2.php AGAIN includes (1) - (for its local database service)</div>
<div> </div>
<div>Basically, in a nutshell, what I&#39;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. </div>

<div>login1.php then includes login2.php which also includes dbconnect.php for its own use.</div>
<div> </div>
<div>So the problem I&#39;m having here is I get the following error when I try to login from any of the 3 main pages:</div>
<div> </div>
<div>[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: <a href="http://localhost/xxxxxxx/A.php" target="_blank">http://localhost/xxxxxxx/A.php</a> </div>

<div> </div>
<div>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.</div>
<div> </div>
<div>Then, I tried include_once for all .php&#39;s but then I run into empty for-each&#39;es as one below:</div>
<div> </div>
<div>[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: <a href="http://localhost/xxxxxxxx/B.php" target="_blank">http://localhost/xxxxxxxx/B.php</a></div>

<div> </div>
<div>Can someone help me with this maze, plz.</div>
<div> </div>
<div>thanks</div>
<div>greymatter</div>
<div> </div>
<div> </div>
<div> </div>
<div> </div></td></tr></tbody></table><br>



      <br>_______________________________________________<br>
PHPwestoz mailing list<br>
<a href="mailto:PHPwestoz@lists.linux.org.au">PHPwestoz@lists.linux.org.au</a><br>
<a href="http://lists.linux.org.au/listinfo/phpwestoz" target="_blank">http://lists.linux.org.au/listinfo/phpwestoz</a><br>
<br></blockquote></div><br><br clear="all"><br>-- <br>Cheers,<br>Keith<br>Australia is merely an island of Antarctica, and of no further significance.<br>
</div>