Prova cosi'
Codice PHP:
 $table '' // nome tabella
 
$where '' // clausola where
 
$sql  "SELECT COUNT(*) AS quanti FROM ".$table." ".$where;
 
$result mysql_query($sql);
 
$total mysql_result($result,"quanti");