$query = mysql_query("SELECT COUNT(`id`) AS total FROM `yyy` where cat='$cat'") or die(mysql_error()); $r = mysql_fetch_array($query);