tags:

views:

58

answers:

2

Hi good people once again

While busy traversing, iterating and manipulating my arrays from a mysql database i have stumbled on a problem, which i know you will be able to help me with - fellow geeks.

I have a COLUMN the contains city names and some cities appear several times on the COLUMN.

I'm using the following query to retrieve that data:

  $query = "SELECT cities from info_table WHERE store='kfc' ";

    $result = mysql_query($query);

while($city = mysql_fetch_array($result){
$total_cities_array[]=$city[0];
}

the problem is that in $total_cities_array some cities are a entered several when i ony need a single storage for every city. is there some php or mysql that i can use to fix this. Thank you.

+9  A: 
SELECT DISTINCT cities from info_table WHERE store='kfc'
Emyr
Thanks you've saved my day!
Q_the_dreadlocked_ninja
Click the tick and accept then...
Emyr
A: 
$query = "SELECT cities from info_table WHERE store='kfc' GROUP BY cities";
Ben Sykes