Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Display only one row from SQL DB if there are several same rows

I would like to display the dates (month and year) of my articles from the newest to the oldest (up to down).

The problem is that when I have several articles which were written in the same month, I have several times the same date whereas I would like to display this date (month and year) only once, even if I have several records featuring this date (month and year) in my database.

Here is what I get for the moment : enter image description here

Here is my PHP code :

$req_arch1 = $bdd->query('SELECT mo,yr FROM articles WHERE status="1" ORDER BY yr DESC, mo DESC');  
  while($req_arch2 = $req_arch1->fetch()){
  echo "<p>".$req_arch2['mo']." - ".$req_arch2['yr']."</p>";
  }

Thanks in advance for your answers.

Comments