MySQL statistics reporter in PHP