On Thu, 24 Jul 2008 11:13:52 -0400
"David Spadea" <[EMAIL PROTECTED]> wrote:

> Mick,
> 
> As I haven't seen anyone else say it, I just wanted to throw this
> in.
> 
> I'm not a PHP programmer, so I'm not very sure of PHP's scoping
> rules, but this looks to me like a variable scoping problem. If
> the first time you've used $content is inside of the while(), it's
> probably going out of scope before your echo. Try this:

[EMAIL PROTECTED]:~$ php -a
Interactive mode enabled

<?php
if(true) {
        $content="it exixts";
}
print $content;
it exixts

The code and PHP scoping are not nice but it should prove that
scoping is not the problem ;)

> # Initialize $content before going into the loop.
> # This declares it outside the scope of the while()
> 
> $content=''';

mistype

> # Now do your loop
> 
> while ($row = pg_fetch_array($query)) {
> $content = $row[0]
> }
> 
> echo $content;
> 
> 
> 
> Your loop is a little weird, too. You're not accumulating anything,
> you're just saving the previous value. When you exit the loop,
> $content will only contain the value from the final row. If that's

for debugging I suggested:
$content .= $row[0]." # ";
So he could see if any row even if all $row[0] contained '' or null.


-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to