Your query would be like this:
$query = "select * from ".$table." ORDER BY RAND() LIMIT 0,10";
RAND() is a MySQL function that chooses a random number. By using LIMIT 0,10, it tells it to user RAND() 10 times--once for each result.
By the way, use mysql_fetch_array($result,MYSQL_NUM)-- there is data there that you aren't using. Using MYSQL_NUM will speed up your results.