I remember someone recently wanting this capability, though searching the forum doesn't produce the request for help. Hrm. In any case, I found this code, which fits the bill:
This script selects one random quote from a MySQL database. Allows the use of HTML tags, so it can be used to display banners, images, bg images, text, links, etc.
Features a marker that prevents displayed quotes to repeat themselves until all quotes have been displayed.
Hope this helps someone.