<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
The output of $conn->query($sql) would be a result set pointer, not
an actual array. <br>
<br>
Try <br>
<br>
$result=$conn->query($sql);<br>
if($result->num_rows>0)<br>
{<br>
while($row=$result->fetch_assoc())<br>
{<br>
... do your magic here<br>
}<br>
}<br>
<br>
On 22/02/2010 9:58 PM, Gnitnop G wrote:
<blockquote cite="mid:820691.43926.qm@web24607.mail.ird.yahoo.com"
type="cite">
<table border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td
style="font-family: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; font-size: inherit; line-height: inherit; font-size-adjust: inherit; font-stretch: inherit; -x-system-font: none;"
valign="top">
<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 moz-do-not-send="true"
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><a class="moz-txt-link-rfc2396E" href="mailto:khan@swcombine.com"><khan@swcombine.com></a></i></b>
wrote:<br>
</div>
<blockquote
style="border-left: 2px solid rgb(16, 16, 255); padding-left: 5px; margin-left: 5px;"><br>
From: Keith Moss <a class="moz-txt-link-rfc2396E" href="mailto:khan@swcombine.com"><khan@swcombine.com></a><br>
Subject: Re: [PHPwestoz] problem with includes<br>
To: "PHP users in Western Australia (or nearby)"
<a class="moz-txt-link-rfc2396E" href="mailto:phpwestoz@lists.linux.org.au"><phpwestoz@lists.linux.org.au></a><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 moz-do-not-send="true"
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="border-left: 1px solid rgb(204, 204, 204); margin: 0px 0px 0px 0.8ex; padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
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 moz-do-not-send="true"
href="http://lists.linux.org.au/listinfo/phpwestoz" target="_blank">http://lists.linux.org.au/listinfo/phpwestoz</a><br>
</div>
</blockquote>
</td>
</tr>
</tbody>
</table>
<br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
PHPwestoz mailing list
<a class="moz-txt-link-abbreviated" href="mailto:PHPwestoz@lists.linux.org.au">PHPwestoz@lists.linux.org.au</a>
<a class="moz-txt-link-freetext" href="http://lists.linux.org.au/listinfo/phpwestoz">http://lists.linux.org.au/listinfo/phpwestoz</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
---------------
Kim Richardson
Web Applications Developer
Viewdale IT
Tel: 1300 799 516 - Fax: (07) 3319 8932
<a class="moz-txt-link-freetext" href="http://www.ausnix.com.au">http://www.ausnix.com.au</a></pre>
</body>
</html>