Re: Unique Names for Variable in Loop
| From: | Ligaya Turmelle | Date: | Fri, 03 Feb 2006 04:02:13 +0000 |
| Subject: | Re: Unique Names for Variable in Loop | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-229789@lists.php.net to get a copy of this message | ||
or you can forget about keeping track of the indexes and just use array_push or the even simpler $names[]=$row['lastname'];
Jim Moseby wrote:
-- life is a game... so have fun.To expand a bit: $index=0; while ($row=mysql_fetch_array($result)){ $names[$index]=$row['lastname']; $index++; } JMI must be brain dead today since I can't get my syntax correct. Simple MySQL query to return a list of last_name. No problem. Each last name returned needs to be assigned to a unique variable like name1, name2, name3, etc.How about $names[1], $names[2], $names[3]? JM