And if I were really being picky, if you wanted to make this uber lightweight... and if you were adding this to a larger site, you would probably want to add some form of caching rather than querying SQL every time.