you have forgot the connection parameter in the mysql_query function, should be something like this..
$mysql_link = mysql_connect("localhost", "username", "password");
mysql_select_db("dbname", $mysql_link);
then:
$result = mysql_query("SELECT * FROM mytable", $mysql_link);
$rows = mysql_num_rows($result);
that should do it..