There are some key security flaws with this database example used here, that unless you take some strong precautions you'll be in a lot of trouble.
The example doesn't specially have a connection function (might have been left out for simplicity) but the reader might assume that its ok to put the mysql_connect method and all the password/login in the DataExtraction() (or in __construct() for php5). This is terrible because assuming common setup, I can simply
and then call your function. Even worse, I can now execute any SQL command I want considering the nature of mysql_query.
There are something’s that you can do to prevent this from happening, like:
1. Setup PHP to run as CGI and disable all read permissions http://us2.php.net/manual/en/security.cgi-bin.php
2. Ensure that you setup a SQL user that only has select permissions if that is all that user is going to be doing, and limit the views. Also, if the SQL server is going to be running on the same server lock the user access to the localhost http://dev.mysql.com/doc/mysql/en/user-resources.html
3. Use a separate connect function that stores the username and password outside of the main database class.
To you credit David, I understand that this is not a discussion on security nor do you make a claim this is how you should do it, but I just feel that it is important especially when creating tutorials for beginners that you pay class attention to security issues like this. More available at http://us2.php.net/manual/en/security.database.php