I'm using a very large table with over 1 million rows of info in my database. I need to continuosly have an accurate count of a certain field and wanted to know which is the fastest and easiest way to get this info from the table.
Which would take the least effort to do this, count() or num_rows.
I know this may be a fairly simple question, I just need to have it clarified in my head. Thanks.
<?
$result=mysql_query("select count(something) from table where username ='$username' and something ='$something'");
while ($row = mysql_fetch_array($result)) {
$amount = $row['count(something)'];
}
$result = mysql_query("SELECT something from table where username ='$username' and something ='$something'");
$num_rows = mysql_num_rows($result);
?>