Update: This code is way old and hasn’t been tested in a while. As such, I have removed it. I’m fairly certain it didn’t work with the newest versions of PHP and MySQL.

I use this code to do my random quote generation. It’s just PHP and works in the newest version (4.3.whatever). The code should still work with older versions, but I used to have some code that doesn’t work on the newest version so I modified the random function. The table I’ve got set up in the database for quotes is called “quotes” and includes a field called source (varchar 80) and quote (text).

Remember to change the spots where it has _db_host, db_user, db_pass,_ and _db_name_ to the correct values for your site.