vendredi 9 mars 2018

php - while - display only if it is the first time a value appears

I'm using a loop to list a column from my database.

while($row=$query->fetch(PDO::FETCH_OBJ)){
}

Everything works fine but I would like to add a condition saying if a similar cell value has been displayed then don't display again...

i.e

  • -result A
  • -result A
  • -result A
  • -result B
  • -result B
  • -result C
  • -result C

to become

  • -result A
  • -result B
  • -result C

Aucun commentaire:

Enregistrer un commentaire