Chapter 18: Mapping from a Database

From Mapping in the Cloud by Peterson

Assignments from (insert your name here)


PHP examples

  1. Writing HTML - Change the HTML file that is written by PHP.
  2. Writing HTML and JavaScript - Change the JavaScript function.
  3. Variable Concatenation - Concontenate a different series of variables.
  4. For Loop - Change the loop parameters so that it either executes more steps, or results in different calculations.
  5. While Loop - Change the loop parameters so that it either executes more steps, or results in different calculations.
  6. If Conditional - Change the if conditional statement.
  7. Random Numbers - Change the number of times that the for loop calculates a random number. Does the average of the random numbers get closer to five as the loop is executed more times?
  8. Date and Time - Search for "PHP Date Function parameters" and change how the time and date are written.

Note: The following examples all read data from a MySQL database. This database must first be created through your webhosting account using the MySQL control panel item. Enter a name for the new database. Some webhosting sites have you create a separate username and password for the MySQL database. The name of the host account, database, user and password in the "mysql_connect.php" file in the PHP_mapping folder:

<?php
$mysql_host = "sql213.podserver.info";
$mysql_database = "podi_14231477_uscapit";
$mysql_user = "podi_14231477";
$mysql_password = "asdfasdf";
$conn = mysql_connect($mysql_host, $mysql_user, $mysql_password) or die ('Error connecting to mysql');
mysql_select_db($mysql_database);
?>

Use phpMyAdmin from the webhosting control panel to create the tables in the MySQL database. First, unzip the code18.zip folder on your computer. Then, use the IMPORT tab in phpMyAdmin to input the three SQL files in the "SQL_data_input" folder. Remember to hit the GO button on the bottom when importing. phpMyAdmin can be used to browse the database. Check to make sure that you have five tables.

Points

  1. US-Capitals - Change the icon that is used to display the cities. Indicate the change in the title.
  2. US-Capitals Population bigger than 1,000,000 - Change to a different population value. Indicate the change in the title.
  3. US-Capitals west of Omaha - Change to a different city. Indicate the change in the title.
  4. US-Capitals north of Omaha and with a population less than 500,000 - Change to a different city and population. Indicate the change in the title.
  5. US-Capitals in a rectangular area (spatial query) - Change to a different area. ADVANCED: Find the total population of all cities in the new rectangle.

Lines

There are errors in the three tables used for the flight routes. Use phpMyAdmin to examine the tables and find and correct the errors.

  1. A few Flight routes of Delta Air - Change to a different line type. Indicate the change in the title.
  2. Just a few flight routes of Delta Air to Atlanta - Change to a different city in the database. Indicate the change in the title.
  3. Delta Air Flights from Omaha - Change to a different city in the database. Indicate the change in the title.

Areas

  1. NE-Counties - Change to a different line color. Indicate the change in the title.
  2. NE-Counties population - Change to a different shading color. Indicate the change in the title.
  3. NE-Counties with a population less than 50,000 - Change to a different population value. Indicate the change in the title.
  4. NE-Counties with a population bigger than 5,000 - Change to a different population value. Indicate the change in the title.
  5. NE-Counties of Omaha, Lincoln and Kearney (spatial query) - Change to different cities. Indicate the change in the title.

Point Input

This example inputs points from a Google Map. It requires setting up a separate MySQL database and modifying the mysql_connect.php file. In contrast to the examples above, no data is initially input through phpMyAdmin.


Return to my assignments page