if you want to count the results of a cerain sql query, you can to the following:
$con = mysql_connect ....
$sql = "select * from sometable";
$result = mysql_db_query("yourdatabase",$sql,$con);
echo $rows = mysql_num_rows($result);
The var $rows will give you the number of rows "selected" by your sql query.
i hope i got your problem right ...
regards
ali