Update stats.php

changed db selection to match $dbname given