A far more efficient and portable way to do that would be:
$query2 = mysql_query("SELECT count(*) FROM results WHERE winner='Carl'");
$carl_wins = mysql_result($query2);
The previous method you used would take the entire row of data for every
time that Carl won and transmit it from the DB to your PHP script. So (making
up numbers here) if Carl won 10 times and each row of data was 100 bytes, it
would transmit 1000 bytes of data.
But all you really want is just one number... so the query I used above
calculates just one number and sends it, and nothing else, to your PHP script. It
might not seem like much now, but were talking about 1000 bytes vs 2
bytes. Not to mention the CPU cycles which will be saved also.
In addition, the above query should be able to be used on just about any SQL
DB through just about any DB abstraction class as it is dependant
only upon SQL and not upon an outside funtion (mysql_num_rows).
I know it doesn't seem like much of a difference now, but things like that can
make a big difference down the road. Like if you project takes off and the DB
gets really large, or if you move the DB to a seperate machine from the PHP
server, or if you find out later that you need a special feature in a different DB
(like PostgeSQL), etc...