18 Mapping from a database Mapping in the Cloud Peterson
Linux PHP and MySQL were largely developed under Linux – open source operating system based on UNIX Linus Torvalds – – “Hello everybody out there! I'm doing a (free) operating system … (just a hobby, won't be big and professional) for 386(486) AT clones. This has been brewing since april, and is starting to get ready.I'd like any feedback.”
PHP and MySQL Most Linux installation procedures include the option of installing PHP and MySQL. Administration of online databases is done through phpMyAdmin – Available through the cPanel Purpose of exercises: – Develop familiarity with PHP – Input and query MySQL tables
PHP example 1 Result: HTML written by PHP This was written in HTML from a PHP script
PHP example 2 Result: The square of 16 is 256.
PHP example 3 Result: A screen with a 1024 x 768 resolution has pixels. A screen with a 1024 x 768 resolution has 786,432 pixels.
PHP example 4 Result: The value of j is: 20 The value of j is: 40 The value of j is: 80 The value of j is: 160 The value of j is: 320
PHP example 5 Result: The value of myCount is: 0 The value of myCount is: 10 The value of myCount is: 20 The value of myCount is: 30 The value of myCount is: 40
PHP example 6 Result: 20 is bigger than 10
PHP Example 6
PHP Example 7
cPanel
MySQL is used to define new tables
SQL
Browse
Structure
SQL
Search
mysql_connect.php
All Capitals
North of Omaha / less than 500,000
Select within box
DROP TABLE IF EXISTS cities; create table cities ( city VARCHAR(30), location GEOMETRY NOT NULL, SPATIAL INDEX(location), PRIMARY KEY (city) ); INSERT INTO cities (city, location) VALUES ("Omaha", GeomFromText('POINT( )')); INSERT INTO cities (city, location) VALUES ("Atlanta", GeomFromText('POINT( )')); INSERT INTO cities (city, location) VALUES ("Lincoln", GeomFromText('POINT( )')); DROP TABLE IF EXISTS dl_airports; create table dl_airports ( city VARCHAR(30), airport VARCHAR(30), code VARCHAR(3), FOREIGN KEY (city) REFERENCES cities(city), PRIMARY KEY (code) ); INSERT INTO dl_airports (city, airport, code) VALUES ("Omaha","Omaha Eppley Airfield", "OMA"); INSERT INTO dl_airports (city, airport, code) VALUES ("Atlanta","Hartsfield-Jackson International Airport", "ATL"); INSERT INTO dl_airports (city, airport, code) VALUES ("Lincoln","Municipal Airport", "LNK"); DROP TABLE IF EXISTS dl_routes; create table dl_routes ( airportCode VARCHAR(3), destinationCode VARCHAR(3), FOREIGN KEY (airportCode) references dl_airports(code), FOREIGN KEY (destinationCode) references dl_airports(code) ); INSERT INTO dl_routes (airportCode, destinationCode) VALUES ("OMA","ATL"); INSERT INTO dl_routes (airportCode, destinationCode) VALUES ("OMA","DET"); INSERT INTO dl_routes (airportCode, destinationCode) VALUES ("OMA","MEM"); Part of the SQL code for entering three tables that provide city location, airport information, and airline connections.
Flight Routes
Selected routes
create table ne_counties ( strokecolor VARCHAR(7), strokewidth INT(5), strokeopacity FLOAT(5), fillcolor VARCHAR(7), fillopacity FLOAT(5), popdata INT(15), name VARCHAR(30), geom GEOMETRY NOT NULL, SPATIAL INDEX(geom) ); INSERT INTO ne_counties (strokecolor, strokewidth, strokeopacity, fillcolor, fillopacity, popdata, name, geom) VALUES ("#008800",1,1.0,"#FFCC00", ,33185,"county", GeomFromText('POLYGON(( , , , , , , , , , , , , ))')); INSERT INTO ne_counties (strokecolor, strokewidth, strokeopacity, fillcolor, fillopacity, popdata, name, geom) VALUES ("#008800",1,1.0,"#FFCC00", ,6931,"county", GeomFromText('POLYGON(( , , , , , , , , , , , , ))')); MySQL commands, attributes, and coordinates for placing two county polygons for Nebraska into a MySQL database.
Nebraska county polygons
Nebraska county population
Counties with less than 50,000
Selection of counties by points