would this be the correct way to display the number or records in a particular table, I am just going to put this in an if statement so if there are more than 20 do something ?
$query = "SELECT COUNT(1) FROM mytable");
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_row($result);
echo $row[0];
use
COUNT(*)instead ofCOUNT(1)generally both will work, the difference is that
COUNT(*)counts number of matched rows andCOUNT(something)calculates number of matched rows for whichsomethingis not null. To clarify, given a table: