PHP Code:
$sql = mysql_query("SELECT COUNT(Key) FROM table");
$rows = mysql_result($sql, $db);
//echo $rows;
There isn't much difference between that example and the one earlier if your not running a large database.
The performance factor between the two methods is negligible for a small database.