Source code example for Web Database Applications
Unless otherwise stated, the source code distributed with this book can be
redistributed in source or binary form so long as an acknowledgment appears
in derived source files.
The citation should list that the code comes from Hugh E.
Williams and David Lane, "Web Database Application with PHP and MySQL"
published by O'Reilly & Associates.
This code is under copyright and cannot be included in any other book,
publication, or educational product without permission from O'Reilly &
No warranty is attached; we cannot take responsibility for errors or fitness
$region_id = clean($_GET["region_id"], 4);
// Connect to the MySQL DBMS
if (!($connection = @ mysql_pconnect($hostName,
die("Could not connect to database");
if (!mysql_select_db($databaseName, $connection))
$query = "SELECT map FROM region
WHERE region_id = $region_id";
// Run the query on the DBMS
if (!($result = @ mysql_query ($query,$connection)))
$data = @ mysql_fetch_array($result);
// Output the GIF MIME header
// Output the image