Couldn't get that to work, but got a SELECT * to work with mysql_num_rows
That is incredibly inefficient, unless you actually want to select everything from all the rows.
If you are using the old MySQL extension, it would be a one-liner:
$num_rows = mysql_result(mysql_query("SELECT COUNT(*) FROM user"), 0);