Possible Duplicate:
MySQL: Select only unique values from a column
iam getting values from mysql table category and column parent. Parent contain values like 1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4
I want to skip the values if they are repeating. So i want the output as 1,2,3,4
Please help me..my code is not woking.
$new_cat1 = $cat1;
foreach($cat1 as $category){
$query="SELECT parent FROM categories where id='$category'";
$result = mysql_query($query);
$line = mysql_fetch_assoc($result);
array_push($new_cat1,$line['parent']);
if (in_array("1", $new_cat1)) {
continue;
}
}