Mimsy Were the Borogoves

Hacks: Articles about programming in Python, Perl, PHP, and whatever else I happen to feel like hacking at.

MySQL for other applications

Jerry Stratton, April 29, 2005

On Tuesday I taught a two-and-a-half hour MySQL tutorial. I’ve placed the manual for that tutorial to the Neon Alley tutorials section. Like most of my tutorials, this document is released under the GNU Free Documentation License.

It is available in RTF (from Word), HTML, and PDF.

Here’s the justification in the introduction:

If you’re going to use MySQL to display information on the web or in another application, you will eventually--sooner rather than later--need to understand the structure of your database and how to construct SQL queries.

Two of the most common applications you’ll use with MySQL are PHP and Dreamweaver. PHP is a programming language, which means you need to understand PHP first. But as soon as you start using MySQL with PHP, you run into the mysql_query() function. PHP has pretty much no built-in MySQL functionality. You construct a MySQL query, give that to PHP, and PHP hands it, intact, to the MySQL server.

Dreamweaver will insulate you from MySQL queries for the first few minutes. But as soon as you start doing anything out of the ordinary, you’ll run up against the “advanced” section of your recordset window. That “SELECT .... FROM... WHERE” phrase in the advanced window is nearly a pure MySQL query.

The appendix also contains some guidance on setting up “record sets” in Dreamweaver, and a sample script that uses PHP, Python, or Perl to output tables from MySQL.

If you notice any errors, please let me know. I’m somewhat unsure about the indexing stuff, for example.

  1. <- Style Sheets 2
  2. SpamAssassin Rules ->