<!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-&gt;query($sql) would be a result set pointer, not
an actual array. <br>
<br>
Try <br>
<br>
$result=$conn-&gt;query($sql);<br>
if($result-&gt;num_rows&gt;0)<br>
{<br>
&nbsp;&nbsp; while($row=$result-&gt;fetch_assoc())<br>
&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ... do your magic here<br>
&nbsp;&nbsp; }<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 &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 moz-do-not-send="true"
 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><a class="moz-txt-link-rfc2396E" href="mailto:khan@swcombine.com">&lt;khan@swcombine.com&gt;</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">&lt;khan@swcombine.com&gt;</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">&lt;phpwestoz@lists.linux.org.au&gt;</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">&lt;<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>&gt;</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>&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 moz-do-not-send="true"
 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 moz-do-not-send="true"
 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 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>