how to filter repeated values in php the result of a search in the database

0

I am creating a system that returns me from the database several dates, but I would like only one of each without the repetitions, I already tried with array_unique, but without success, I think it must be because my research returns in OBJ association, if anyone can give me a suggestion I would be grateful.

$ sql_historico="SELECT * FROM historico WHERE id_condominio=". $ id_condominio;        $ historico = $ PDO-> prepare ($ sql_historico);

   $historico->execute();
   if($historico->rowCount()>0){
    while($valor_historico = $historico->fetch(PDO::FETCH_OBJ)){
     $historico_data = $valor_historico->data;

} }

    
asked by anonymous 24.11.2018 / 17:39

1 answer

0

I would like to inform you that I got a simpler solution, I used a SQL feature that filters and groups the result deleted repeating values (GROUP BY + field name of the table you want to delete equal values.

    
25.11.2018 / 18:09