How do I count the rows in the table?

In fact, each publication in personalized publication type contains only one table which has several different rows. Each row is important, so we want to count them for a function and I think it is possible to count

labels I want to show the number of the rows in single.php and even show in archive.php As an element for each position by a function. in the loop.
Would you be so kind to help me?
Maybe it's possible in a loop without a function!
.
What about this?

function tr_count () {
ob_start ();
the content();
$ content = ob_get_clean ();
return substr_count ($ content, & # 39;

& # 39;);
}

and for use:
<? php echo tr_count (); ?