php mysql query display one instance of a value in field

darkmix

New Member
I have this query that searches my database for accommodation that has a type that is equal to e.g. "Hotel" it then outputs the results in an list displaying the location of the hotels. Basically because there are lets say 4 hotels in Windermere, Windermere is coming up 4 times. Is there anyway I can tell it to only display one instance of one value? Thanks in advance\[code\]<?phpinclude $_SERVER['DOCUMENT_ROOT']."/include/dbcon.php";$query = "SELECT * FROM Places WHERE Type ='$type'" or die(mysql_error()); $result = mysql_query($query) or die(mysql_error());echo "<ul>";while ($row = mysql_fetch_array($result)) {$link = $row ['Location'];$link = strtolower($link);$link = str_replace(" ", "-", $link);$link = str_replace(".-", "-", $link);echo "<li>";echo "<a href='".$link."/"."'>".$row['Location']."</a>";echo "</li>";}echo "</ul>";mysql_close($con);?>\[/code\]
 
Back
Top