Kayıt satısını SELECT COUNT(id) AS TOPLAM ... şekilnde count komutu ile alıp sonucu değişkene atayıp
for ile döngüye alıp listeleyebilirsin.