Plus there's no need for the Count(*) thing that you suggest as after running a SELECT query mysql_num_rows($dbh) contains the number of returned rows. If you were doing insert, update or deletes the mysql_affected_rows($dbh) does the same thing.
While I'm here I've noticed that quite a few of the PHP functions have been either deprecated, or are actually just an alias to another call, eg.
mysql_create_db("DMDB") == mysql_query("CREATE DATABASE DMDB) - deprecated
mysql_select_db("DND", $dbh) == mysql_query("USE DND");
mysql_list_dbs() == mysql_query("SHOW DATABASES")
mysql_list_tables($dbName) == mysql_query("SHOW TABLES")
//leading to
mysql_tablename($result, $i) and mysql_db_name($result, $i) are just aliases to mysql_result
It's all in the book, I'm just slapping it together.