The easiest way to solve yuor problem is to use PHP:
$res=$db->select ("Select count(*) from mytable");
$count=$res[0][0];
and after use variable $cound in ANY queries you need, it stores amount of rows in table "mytable".
But if you need to use count() in other queries using only SQL script ,tell me exactely for which queries you need count() ( select or insert, or update).