<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV>30 <div id="artdescription"><BR> <?php<BR> foreach ($conn->query($sql) as $row) {<BR> ?><BR> <h2><?php echo $row['title']; ?></h2><BR> <p><?php $extract = getFirst($row['article']); <BR> echo $extract[0];<BR> if ($extract[1]) {<BR> <BR> echo '<a href="abstractexplanation.php?article_id='.$row['article_id'].'">
More</a>';<BR> } ?></p><BR> <?php } ?><BR>41 </div></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>ps: according to my sketched-out example, that last error should look like this:</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\\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> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>--- On <B>Mon, 22/2/10, Keith Moss <I><khan@swcombine.com></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 <khan@swcombine.com><BR>Subject: Re: [PHPwestoz] problem with includes<BR>To: "PHP users in Western Australia (or nearby)" <phpwestoz@lists.linux.org.au><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><<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>></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> </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) & (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'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'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 rel=nofollow>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's but then I run into empty for-each'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 rel=nofollow>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="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>