Re: query_data

From: Date: Sat, 06 Dec 2003 15:04:25 +0000
Subject: Re: query_data
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-172064@lists.php.net to get a copy of this message
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

« previous php.general (#172064) next »