Re: problem with a while loop

From: Date: Fri, 26 Oct 2001 07:26:44 +0000
Subject: Re: problem with a while loop
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72408@lists.php.net to get a copy of this message
On Fri, 26 Oct 2001 16:40, Richard Kurth wrote: > I am trying to get the data out of the while loop if I echo $email > inside the } it gives me all of the data but if I echo it out side of > the loop it only gives me one record even though I know there is > more. How can I get this to work > > $query = "SELECT * FROM members Where Company LIKE '%$search1%'"; > $result=mysql_db_query($dbName,$query); > while ($row = mysql_fetch_array($result)) { > $email= $row["lname"] . " " . "<" . > $row["E_mail_1"] . ">" . ";"; > } > > > echo $email; You would probably want to append the values to $email in your loop, then. As it is, you are overwriting the value in $email each pass through the loop. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA I'm fascinated by the way memory diffuses fact.

« previous php.general (#72408) next »