arrays, variables, and register_globals

From: Date: Thu, 25 Jul 2002 05:33:30 +0000
Subject: arrays, variables, and register_globals
Groups: php.db 
Request: Send a blank email to php-db+get-20769@lists.php.net to get a copy of this message
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

« previous php.db (#20769) next »