I have a search that takes the 3 most relevant results in my DB, and then I separate the categories of those 3 results into an array within a While, so it looks something like:
while($x = $x->fetch()){
$array = explode(',', $x["categoria"]));
foreach($categoria as $array){
$->busca no banco de dados cada categoria
$->while convertendo e retornando os dados relacionados
}
}
And within the foreach I want to do the search for the results related to the category of the array in question, however is that when a result fits in more than one category it comes duplicated in the list, my doubts are: How can I delete these duplications? Will it be heavy 3 repetition loops one inside the other?