$query = "SELECT count(nome_campo) AS total FROM nome_tabella";
scusami cos'è total???