I am looking for a way I can remove duplicate values from a PHP array from a resulting MySQL query. What I have so far gives me the query I want but shows any duplicates consistantly. I need to remove them for a navigation menu. Any help would be appreciated.
This is what I have so far...
$c_search = mysql_query("SELECT * FROM members WHERE interest1 LIKE '%$input%' or interest2 LIKE '%$input%' or interest3 LIKE '%$input%'");
$array = Array();
while($rows = mysql_fetch_assoc($c_search)) {
array_push($array, $rows['interest1']);
array_push($array, $rows['interest2']);
array_push($array, $rows['interest3']);
for($i=0; $i<count($array); $i++) {
echo $array[$i] . "
";
}
}
I have tried changing the MySQL query to use DISTINCT, no luck. I tried using array_unique($array, SORT_STRING), no luck. Not sure what elese to try. Please help, thanks.