In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] says...
> 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"; // 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, $row, 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,
In the first case, $row 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.
Quod subigo farinam
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php