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" <[EMAIL PROTECTED]>
To: "Randy Johnson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
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
>
>

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

Reply via email to