How to stop fetching same data from database?
Posted: Fri May 15, 2009 9:27 am
I am retrieving states of USA on this page http://www.wewillbook.com/world-hotel-d ... tabase.php by using the below code. How to stop repeating the same state names. How can i do it?
Code: Select all
<?
$sql = "SELECT `State` FROM `citystatecountry` WHERE `Country` = 'USA' ORDER BY `State` ASC";
$result = mysql_query($sql);
while($row = mysql_fetch_assoc($result)){
echo $row['State'].'<br />';
}
?>