Randy Johnson wrote:
I have a query

$query="select a,b,c,d,e from table where id='z'";
$result=mysql_query();

$query_data=mysql_fetch_array($result);

I normally would do this:

$a=$query_data["a"];
etc..

is there a way to do this is in a loop so I do not have to do all that
typing?

You already have a variable called $query_data['a']... why do you need to make another variable? You're just wasting time and memory. If you want it shorter, then assign the result to $r so you have $r['a'], or something similar.


However, if you just _have_ do to this, then use extract().

--
---John Holmes...

Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals – www.phparch.com

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to