This should work:
$query = "SELECT COUNT(*) FROM tablename";
$result = mysql_query( $query );
$count = mysql_result( $result, 0, 0 );
echo $count;
If you do a SELECT blah AS blah2 then this should work:
$query = "SELECT COUNT(*) AS num FROM tablename";
$result = mysql_query( $query );
$row = mysql_fetch_array( $result );
echo $row["num"];
Trying to access the row element without putting the inde string in "" should be an error. If not, it's just php being overly gracious. Feel free to correct me if I'm wrong. I don't have access to php right now.