Re: query_data

From: Date: Sat, 06 Dec 2003 15:13:54 +0000
Subject: Re: query_data
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-172066@lists.php.net to get a copy of this message
oh my gosh, I have been coding php for 4 years now. They way I did it before I saw in numerous examples from the books that I had bought. I think of all the code I have wrote and I did not even have to do it that way. Thanks a bunch, Randy ----- Original Message ----- From: "John W. Holmes" <holmes072000@charter.net> To: "Randy Johnson" <rjohnson@seasidepc.com> Cc: <php-general@lists.php.net> Sent: Saturday, December 06, 2003 10:04 AM Subject: Re: [PHP] query_data > 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 > >

« previous php.general (#172066) next »