Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week Four CIT 354 Internet II. 2 Objectives Uploading Files to Your Web Site Establishing a Connection Creating a Database Table Common Programming Errors.

Similar presentations


Presentation on theme: "Week Four CIT 354 Internet II. 2 Objectives Uploading Files to Your Web Site Establishing a Connection Creating a Database Table Common Programming Errors."— Presentation transcript:

1 Week Four CIT 354 Internet II

2 2 Objectives Uploading Files to Your Web Site Establishing a Connection Creating a Database Table Common Programming Errors Summary Mid-term, Homework, and Project

3 3 Uploading Files to Your Web Site Check Your php.ini File Understanding the Process Creating the Form Creating the Upload Script Uploading a File Using Your Form and Script

4 4 Check Your php.ini File Uncomment the upload_tmp_dir A directory name = /My Documents/temp

5 5 Understanding the Process Creating the Form –upload_form.html (P 170) Creating the Upload Script –do_upload.php (P 173) –modify the path name / Program Files/Apache Group/Apache/htdocs/ Group/Apache/htdocs/ Submitting your Form and Getting Results

6 6 Establishing a Connection Connect to MySql List all databases on localhost List all tables in a database Create a database Drop (delete) a database

7 7 Working with User Privileges in MySql Creating a New User –GRANT [privilege list] ON databasename.tablename TO username@host IDENTIFIED BY “password” username@host –cd c:\mysql\bin and issue mysql –use mysql; Connecting to MySql –Command: mysqlconnect –Example: db_connect.php (P181) Breaking Your Connection Script –Example: db_connect.php (P183)

8 8 List all databases on localhost Listing Databases on a Server Commands: –mysql_list_dbs() –mysql_num_rows() –mysql_tablename() Example: db_listdb.php (P 186)

9 9 List all tables in a database Command: mysql_list_tables() Example: db_listtablesdb.php (P 188)

10 10 Create a New database Command: $new_db Example: db_createdb.php (P 193) Tests –Re-start Apache and then run db_listdb.php –Restart mysql

11 11 Drop (delete) a database Command: $drop_db Example: db_dropdb.php (P 196)

12 12 Creating a Database table Plan for a database table Recognize the pitfalls of certain data types Recognize the importance of unique fields Follow a three-step process for table creation Create a table to hold your personal music catalog

13 13 Planning for Your Tables Basic MySQL Data Types –Table 12.1 Some MySQL Data Types –Examples: TINYINT (1 byte), SMALLINT (2 bytes), MEDIUMINT(3 bytes), INT (4 BYTES), BIGINT(8 bytes), FLOAT(M,D), DATE(YYYY-MM-DD) Defining Your Fields –Define fields correctly –Define fields with the right SQL syntax –Steps: 1. The name of the table and number of fields 2. Display additional form fields 3. Verification

14 14 Planning for Your Tables Table 12.2 Fields for my_music The importance of Unique Fields –An ID Field can be used as the unique field A Three-Step Form Sequence Step 1: Number of Fields Example: show_createtable.html (P 203) Step 2: Defining Your Fields Example: do_showfielddef.php (P 205) Step 3: Creating the Table Example: do_createtable.php (P 212) Use your own ID and PW to connect MySQl.

15 15 Common Programming Errors Omitting or incorrectly typing the opening tag <? that signifies the start of a PHP statement. Omitting or incorrectly typing the closing tag ?> that signifies the end of a PHP statement. Misspelling the name of a variable or function. Forgetting to close a string with a double quote symbol. Dividing integer values incorrectly. Forgot to use the escape (\) character. Using a variable in an expression before a value has been assigned to the variable. Incorrectly typing the letter O for the number zero (0), or vice versa. Incorrectly typing the letter l, for the number 1, or vice versa.

16 16 Chapter Summary Uploading Files to Your Web Site Establishing a Connection Creating a Database Table

17 17 Mid-term, Homework, and Project Mid-term –Date: Next Week Homework 3 –Due Date: Next Week Project 1 –Due Date: Next Week –Team Approach( 1 – 3 members)


Download ppt "Week Four CIT 354 Internet II. 2 Objectives Uploading Files to Your Web Site Establishing a Connection Creating a Database Table Common Programming Errors."

Similar presentations


Ads by Google