In article <[EMAIL PROTECTED]>, 
> I developed my site on a server where register_globals was off; now I'm
> putting the site up on a server where they are on.
> I know how to echo the value of a variable that is passed in the
> querystring, but I'm having trouble echoing the value of a variable that is
> in my select statement--I can get the value when it is in a while loop, but
> outside of that I'm having trouble:
> $query = "Select blah1, blah2, blah3 from blahtable";
> $result = mysql_query ($query)
>  or die ("Cannot complete query");
> print "$row[1]";   // this is the kind of thing that is not working...I
> tried get_defined_vars() but may not have used it correctly
> while ($row = mysql_fetch_row ($result))
> {
>  print "$row[1], $row[2], etc.");
> }
> ?>
> In the above example, the variables in the while loop get expanded, but the
> one outside doesn't....
> Can anyone help?
> thanks in advance,
> Matt

In the first case, $row[1] doesn't exist; so of course it will not show 
anything. The array $row doesn't get any contents until you assign the 
values from mysql_fetch_row to it.

David Robley
Temporary Kiwi!

Quod subigo farinam

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to