<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>30 &nbsp;&nbsp;&nbsp; &lt;div id="artdescription"&gt;<BR>&nbsp;&lt;?php<BR>&nbsp;foreach ($conn-&gt;query($sql) as $row) {<BR>&nbsp;?&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;h2&gt;&lt;?php echo $row['title']; ?&gt;&lt;/h2&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;p&gt;&lt;?php $extract = getFirst($row['article']);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo $extract[0];<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if ($extract[1]) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo '&lt;a href="abstractexplanation.php?article_id='.$row['article_id'].'"&gt;
 More&lt;/a&gt;';<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; } ?&gt;&lt;/p&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;?php } ?&gt;<BR>41&nbsp;&nbsp;&nbsp; &lt;/div&gt;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>ps: according to my sketched-out example, that last error should look like this:</DIV>
<DIV>&nbsp;</DIV>
<DIV>[Mon Feb 22 12:26:49 2010] [error] [client 127.0.0.1] PHP Warning:&nbsp; Invalid argument supplied for foreach() in C:\\Program Files\\Apache Group\\Apache2\\htdocs\\xxxxxxxx\\B.php on line 31, referer: <A href="http://localhost/xxxxxxxx/B.php" target=_blank rel=nofollow>http://localhost/xxxxxxxx/B.php</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>--- On <B>Mon, 22/2/10, Keith Moss <I>&lt;khan@swcombine.com&gt;</I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid"><BR>From: Keith Moss &lt;khan@swcombine.com&gt;<BR>Subject: Re: [PHPwestoz] problem with includes<BR>To: "PHP users in Western Australia (or nearby)" &lt;phpwestoz@lists.linux.org.au&gt;<BR>Date: Monday, 22 February, 2010, 11:32<BR><BR>
<DIV id=yiv974069415>Ah I see it'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="http://uk.mc246.mail.yahoo.com/mc/compose?to=gnitnop@ymail.com" target=_blank rel=nofollow ymailto="mailto:gnitnop@ymail.com">gnitnop@ymail.com</A>&gt;</SPAN> wrote:<BR>
<BLOCKQUOTE class=gmail_quote style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<TABLE cellSpacing=0 cellPadding=0 border=0>
<TBODY>
<TR>
<TD vAlign=top>
<DIV>&nbsp;</DIV>
<DIV>Hi All!</DIV>
<DIV>&nbsp;</DIV>
<DIV>I seem to be having a problem with&nbsp;php includes. sketching out my problem with an example will look something like this:</DIV>
<DIV>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV>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. </DIV>
<DIV>login1.php then includes login2.php which also includes dbconnect.php for its own use.</DIV>
<DIV>&nbsp;</DIV>
<DIV>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:</DIV>
<DIV>&nbsp;</DIV>
<DIV>[Mon Feb 22 12:06:40 2010] [error] [client 127.0.0.1] PHP Fatal error:&nbsp; 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 rel=nofollow>http://localhost/xxxxxxx/A.php</A> </DIV>
<DIV>&nbsp;</DIV>
<DIV>I get the same error when clicking from AB or C. Only the referer page in the trace changes and&nbsp;the rest are all the same each time.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Then, I tried include_once for all .php's but then I run into empty for-each'es as one below:</DIV>
<DIV>&nbsp;</DIV>
<DIV>[Mon Feb 22 12:26:49 2010] [error] [client 127.0.0.1] PHP Warning:&nbsp; 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 rel=nofollow>http://localhost/xxxxxxxx/B.php</A></DIV>
<DIV>&nbsp;</DIV>
<DIV>Can someone help me with this maze, plz.</DIV>
<DIV>&nbsp;</DIV>
<DIV>thanks</DIV>
<DIV>greymatter</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV></TD></TR></TBODY></TABLE><BR><BR>_______________________________________________<BR>PHPwestoz mailing list<BR><A href="http://uk.mc246.mail.yahoo.com/mc/compose?to=PHPwestoz@lists.linux.org.au" target=_blank rel=nofollow ymailto="mailto:PHPwestoz@lists.linux.org.au">PHPwestoz@lists.linux.org.au</A><BR><A href="http://lists.linux.org.au/listinfo/phpwestoz" target=_blank rel=nofollow>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></DIV><BR>-----Inline Attachment Follows-----<BR><BR>
<DIV class=plainMail>_______________________________________________<BR>PHPwestoz mailing list<BR><A href="http://uk.mc246.mail.yahoo.com/mc/compose?to=PHPwestoz@lists.linux.org.au" ymailto="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></DIV></BLOCKQUOTE></td></tr></table><br>