MySQL Cookbook - Examples
This page provides links to several web scripts that are either discussed in
MySQL Cookbook or that are based on techniques shown in the book.
(You may find it helpful to examine the source code for the scripts when
you try them out.
The scripts are available from the
downloads page.)
-
Simple FULLTEXT searching.
This script uses the
mcb-kjv
distribution as a source of searchable text.
It demonstrates both keyword and phrase searching techniques.
[Run search]
-
Date-based searching.
There are
43
baseball players with birthdays today,
November 20.
To see who they are, use one of these scripts:
[PHP version]
[JSP version]
These scripts
include a simple form that allows you to specify a month and
day, so that you can find ballplayers born on any day of the year.
The scripts are based on information available from
The Baseball Archive.
-
Tired of not knowing why a data file results in lots of warnings when you
load it into a table with
LOAD DATA?
The
load_diag.pl
script can determine for you what's wrong with your file.
[See example]
-
Using database content to generate web output.
clicksort.pl
retrieves the contents of the
mail
table from the cookbook database and displays it as an HTML
table.
The column headings are active links that you can select to re-sort the
table by the corresponding column.
[Run script]
-
Using database content to generate navigational elements:
-
The Book of Esther, displayed in a single page with in-page navigational
links to each chapter.
[Run script]
-
The Book of Esther, displayed using a separate page for each chapter along
with navigational
links to each page.
[Run script]
-
A list of states in the United States as a paged display with generic
"previous page" and "next page" links.
[Run script]
-
A list of states in the United States as a paged display with links to
each of the individual pages of the display.
[Run script]
-
Access counting and logging.
These scripts serve both as hit counters (total number of page accesses) and
as hit loggers (when each access occurred).
Each script displays the current hit count and a list of the times at which
the last 10 accesses occurred.
[Perl version]
[PHP version]
[Python version]
[JSP version]
-
Web session support.
Each of these these scripts
uses a session record stored in MySQL to keep track of how many
times you invoked the script and the times at which you invoked it.
After the 10th time, the session information is discarded and starts over.
[Perl version]
[PHP version]
[JSP version]
If you find that one of these examples doesn't appear to work properly,
please let me know.
Inquiries may be sent to
mysql-cookbook@kitebird.com.
Last modified: February 9, 2006
[MySQL Cookbook main page]