Title: Competency 4.2, 2402--Intermediate Web Programming
Course: Intermediate Web Programming (25436)

ITSE 2402 Intermediate Web
PHP/MySQL Module 4.2 Assignment

Assignment

1. Our class server does not allow you to create a databae through coding (I'm assuming this is a security measure.) Therefore, you work from a class database and work on in localhost mode on your own computer.
2. Getting Started with MySQL using your XAMP server (Not the instructions under Logging in to MySQL on pages 392 - 394 of your textbook. We do not have access to the MySQL on the school server.).

Logging in to MySQL
  - localhost:
    - If you are using a server other than the XAMP server I linked to at the beginning of the course, follow the instructions of that server to open the MySQL Console.
    - Start your XAMP server if it is not running.
    - Left click on the XAMP server icon in your system tray.
    - Hover over MySQL
    - Click on MySQL console
    - The MySQL console appears with the instruction:
Enter password:
Press the enter key. Do not enter a password.
    - Although not identical, your screen will appear similar to Figure 7-6. (page 393)
    - Enter either exit; or quit; to close the MySQL Monitor.
    - Bye will appear on the screen, but the screen will close so you might not see it.
Working with the MySQL Monitor
  - To access MySQL from PHP scripts, you must write SQL commands manually.
  - When you enter a SQL command at the mysql> command prompt, you must terminate the command with a semicolon.
  - If you leave off the ending semicolon when you enter a SQL statement, the MySQL Monitor assumes that you want to enter a multiple-line command and changes the prompt to -> so that you can enter more statements.
  - If you forget to enter the semicolon and get the -> prompt when you meant to end the instruction, just enter the semicolon on the next line. (Our server actually doesn't require the semicolon.)
  - If you enter incomplete data and get a different prompt, such as '> you need to either complete the command that is wrong or close your console and reopen it. I'm sure there is another fix. I just couldn't find it on Google.
  - SQL keywords entered in the MySQL Monitor are not case sensitive. By convention, SQL keywords are entered in uppercase to distinguish them from identifiers. WARNING: Our server is a Linux server. All identifiers are case sensitive. It is only the keywords that are not case sensitive. Field and index identifiers are not case sensitive on all platforms.
Getting Help with MySQL Commands
  - Enter either help; or ? at the MySQL Monitor command prompt to get a list of SQL commands and descriptions.
  - Complete the steps on page 398 to view the command list in the MySQL Monitor. Until a password has been set, you only need to press the enter key when asked for a password.
Working with MySQL Commands
  - localhost:
    - From your MySQL Monitor enter SHOW DATABASES;
    - you will see
information_schema
mysql
    - Enter
USE mysql;
You will see Database changed
    - Enter
SELECT DATABASE();
Remember to enter the parentheses
Your screen will be similar to Figure 7-8.
    - You can change the database you are working with simply by selecting a different database. You do not have to exit the console or go up a level (like you do when working with files and folders).
  - server:
    - If you need to login again, do so
    - enter SHOW DATABASES;
    - you will see
information_schema
a database for all students
flightlog
guitars
mysql
test
    - Everyone has access to all databases. Whatever you change, will be reflected for everyone in the class.
    - Enter:
USE last41442xx;
You will see Database changed
    - Enter:
SELECT DATABASE();
Remember to enter the parentheses
Your screen will be similar to Figure 7-8 except instead of mysql you will see last41442xx
Creating Databases
  - localhost:
    - Reopen your MySQL Monitor.
    - At the mysql command line, enter
CREATE DATABASE guitars;
If the guitars database is successfully created, you will see the message
Query OK.
    - The create command only creates the directory for the guitars database.
    - Before you can add records to a new database, you must first define the tables and fields.
    - To select a database that has been created, the command is
USE
followed by the name of the database.
    - Follow the steps on pages 405 and 402 to create and delete a database.
  - server:
    - After you have logged in, entered your password, and entered USE last41442xx;,
    - At the mysql command line, enter
CREATE DATABASE lastguitars; (using the first 4 letters of your last name)
If the CREATE lastguitars database is successfully created, you will see the message
Query OK.
    - Enter:
SHOW DATABASES;
to see if you added your database.
    - Enter:
DROP DATABASE lastguitars;
If the drop is successful, you should see the message
Query OK>
    - Enter:
SHOW DATABASES;
to see if you deleted your database.
Managing User Accounts |   - Skip this section for now. I am having you step through in a different order because it seems more logical to me.
Creating Tables
  - localhost:
    - Databases also store data according to type.
    - MySQL has a VARCHAR data type for a variable length string in addition to the CHAR type which is a fixed length string.
    - When declaring data types, choose the type that will serve your purpose and that takes up the smallest amount of memory space.
    - Page 404 shows you how to create a table named vehicles for the vehicle_fleet database.
    - Once you have a vehicle_fleet database, to create the table you must give the instruction to USE vehicles;
Create Tables
  - localhost:
    - Follow steps 1 through 4 on pages 405.
  - server:
    - After you login, enter your password, be sure that you USE last41442xx;
to test that you are using your database, enter:
SELECT DATABASE();
if the last41442xx; database is not selected, select it with the use command.
    - Then follow steps 3 and 4 on page 405
    - You should see a screen similar to Figure 7-9.