Fortunes
Now that you have learned how to create snippets, let us create a snippet that displays a random fortune from the database. Fortunes are just quotations from famous texts. These are like a "quote of the day". They are called fortunes in the UNIX culture, after the introduction of the command-line program called fortune, many decades ago.
Creating the table
We will create a table that will hold the fortune and the author's name, using phpMyAdmin, to keep it simple. Most snippets that use a custom table will automatically create the table, if it doesn't exist already.
1. Open phpMyAdmin. The URL for phpMyAdmin will be different depending on your method of installation. If you choose to install Apache and PHP individually, then you will have to install phpMyAdmin first. If you are using XAMPP, as explained in Chapter 2, Getting Started, then the URL is
http://localhost/phpmyadmin
.2. Log in using the username mySQL and the password that you created initially.
3. Click on the learningMODx...