Re: a function for retuned vatiable

From: Date: Mon, 02 Oct 2006 21:05:38 +0000
Subject: Re: a function for retuned vatiable
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-242493@lists.php.net to get a copy of this message
On Mon, October 2, 2006 7:08 am, Ross wrote: > What I need is a quick way to assign variable names to the same value > of the > row name. > > example.. > > $query= "SELECT * from $table_name WHERE sname=='hulford'"; > > $result = mysql_query($query) or die('Error, query failed'); > while ($row=mysql_fetch_array($result)) { > > > $email = $row['email']; > $name=$row['name']; > $address = $row['address']; > > //this goes on for 30 fields is there a way to automate this? > > > } http://php.net/extract Just do *NOT* do it with $_GET / $_POST / $_REQUEST -- You may as well just turn register_globals back on if you're gonna do that. Same thing either way, so you gain nothing in terms of the [some say alleged] benefits of register_globals off, if you're just gonna turn around and pollute your variables anyway. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So?

« previous php.general (#242493) next »