Penso che sia corretto il count(). Fai capire che gli articoli (qualunque) debbano restare entro le 15 unità più recenti. Per stabilire il recente ci sarà un id oppure una data.
select count(*) as tot from tabella ....
.....
if($tot > 15) {
$tot = $tot - 15;
DELETE from tabella order by id ASC LIMIT $tot
} else { echo "i record sono solo $tot"; }
![]()