
July 27th, 1999, 02:28 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
Keep in mind that there are many ways you could do it, however here is one:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
<?
while($row=mysql_fetch_array($queryResult)){
if(!$city){$city[0]=$row["cityName"];} #First city is automatically entered
else{
$i=0;
$cityMax=count($city);
$cityExists=0;
while($i<$cityMax&&!$cityExists){
if($city[$i]==$row["cityName"]){$cityExists=1;}
}
if(!$cityExists){$city[]=$row["cityName"];} #if city not already in list then put it in
}
}
?>
[/quote]
The resulting cities will be in the $city array.
Of course, you'll have to customize it to fit in your script, and I haven't actually tested this code, so it may not work. But in either case it should give you a good idea of what it would look like.
[This message has been edited by moderator (edited 07-27-99).]
|