MySQL with PHP

Spring 2016

Professor:Sam Sultan []
Class website: [] (or) []
Office hours: By Appointment
Course Dates: 2/14/2016 - 3/6/2016
Course Days: Sundays
Course Hours: 9:00am - 5:00pm
Location: 7 East 12th Street - room 223


+ outline
+ books
+ grades policy
+ final project
+ student listing
+ homework submission
+ MySql examples/demos
+ PHP examples/demos
+ student feedback
+ student evaluation & comments

Session - 1   2   3   4   5   6   7   8   9   10   11   12  

SQL - PHP - MySQL Manual - SFTP (PC) (MAC) - WAMP (download) - MySQL GUI (Workbench) - PHP*Tester © - SQL*Tester ©
Site Helpful?


Learn the fundamentals of two of today's most popular tools in the web development space. MySQL is the world's most popular open-source database management system. Because it is readily available, low cost, and easy to install and use, many Internet service providers use MySQL and offer access to MySQL database services to potential clients. PHP is another open-source programming language that has gained tremendous popularity in the web development environment. Learn both MySQL and PHP, and use this powerful combination to design user-friendly, form-based HTML front ends that communicate with MySQL database servers to create dynamic websites.


1. Course Objectives:

The objective of this course is to teach you the fundamentals behind the SQL language using the MySql database. MySql is an open source database that is used in over 3 million installations. We will discuss the relational database model, and will learn about SQL (Structured Query language) both as an ANSI standard language and how MySql implements those standards. We will learn and use DDL (Data Definition Language) to create and delete database objects, and DML (Data Manipulation Language) to access and manipulate those objects.

As part of this course, we will also learn PHP. We will use PHP to create a bridge between the MySql database and HTML forms and other web presentation pages

The focus of the course will be on the following topics:

2. Student Learning Outcomes:


See [Requirements and Policies]

BOOKS - (Required / Suggested)


Details of Assignment and Evaluation.

How to Submit Homeworks.

- Homework assignments are always due the next session we meet.
- Print out your homework code and output and bring with you to class the next time we meet.
- I will either collect, or will ask students to discuss their solutions in class.
- I will not accept homework via email unless you are not able to attend the class.
- For PHP, proper indentation is a must. If not properly indented I may return it without grading it.
- Multiple pages should be stapled together.

Grades are FINAL.

Please do not negotiate for a better grade. If you are expecting to receive a grade of an "A" at the end of the semester, then I expect you to attend all sessions (unless I am notified ahead of time), to participate in these sessions, to keep up with the class reading material, and to complete your homework assigments. This will ensure that you stay current with the class content, and will ensure that you get a good grade on your test(s), project as well as your final grade.

If you are not interested in a grade, or you do not submit your homeworks/project or take the exams, then you will receive a grade of an "NE" (Non-Evaluative). A grade of NE is final, and cannot be changed. A grade of NE cannot be applied as partial fulfillment for any NYU certificate program.

NYU/SPS Grading Scale -

GradeVerbal InterpretationGardation, Conversion and Scale
A Exceptional work
Superior effort
A = 93-100 = 4.0
A- = 90-92 = 3.7
(there is no A+)
B Very good work B+ = 87-89 = 3.3
B = 83-86 = 3.0
B- = 80-82 = 2.7
C Satisfactory work C+ = 77-79 = 2.3
C = 73-76 = 2.0
C- = 70-72 = 1.7
(mininum passing grade)
F Fail. Unsatisfactory work F = below 70 = 0.0
IP Incomplete -
Failure to complete assigned work
(see note below)
IF Incomplete Fail -
Failure to complete assigned work
(see note below)

Notes for IP and IF -

Grade IP - Work to date was passing. Incomplete Pass (IP) may be granted only in extraordinary extenuating circumstances. It is not given automatically but only when it is deemed to have met the criteria and when a contract is signed by both the student and faculty prior to the end of the course. Pre-approval by the Academic Department is required before an Incomplete Grade can be awarded. Students must have completed at least 50% of the course to be considered for an IP. If the terms of the IP are not met within the time frame stated on the contract, the grade will convert to an F and cannot be changed or further appealed. Students will have to retake the course.

NOTE: A student who receives an IP grade may not simply retake a test or exam already taken. The student must do additional new work to remove the IP as outlined in the contract. There is a grade point deduction from the overall grade for late submission of work.

Grade IF - Work to date was failing. Students must have completed at least 50% of the course to receive an Incomplete. An IF that is not removed by the established time in the Contract becomes an F and cannot be changed or further appealed. Students will have to retake the course.

Please Note: The Office of the University Registrar maintains individual records of students enrolled in NYU and is the only department authorized to record an official grade. Final grades are reported on NYU-Albert.
For more information:

To receive your final grade at the end of the semester, follow these steps:

  1. click on
  2. Log into Albert using your net id, at:
  3. Click on "Student Center"
  4. Within your student center, in the "academics" section click on the dropdown: "other academic"
  5. From the dropdown select "grades"
  6. For complete instructions click here


[Week 1] 1 SQL - Structured Query language
DDL - Data Definition language
DML - Data Manipulation Language
SQL standard vs. vendor extensions
Our first database
The SELECT statement
The FROM clause
The WHERE clause
Comparison operators

Reading: Chapters 2, 3 (Teach Yourself SQL in One Hour a Day)
[Week 1] 2 Selecting data from multiple tables
The join construct
Old vs. new join syntax
Normal or Inner join
Cross join - Cartesian product
Outer join vs. Inner join
What is a Self Join
Performance considerations

Reading: Chapter 5 (Teach Yourself SQL in One Hour a Day)
[Week 1] 3 SQL built-in Functions
Arithmetic functions - ABS, RAND, ROUND, TRUNCATE
The CASE expression
Date functions - Current date, date manipulation, date formatting

Reading: Chapter 7, 12 (Teach Yourself SQL in One Hour a Day)
[Week 2] 4 Aggregating and Grouping
Aggregate functions - COUNT, SUM, AVG, MIN, MAX
Grouping with GROUP BY clause
The HAVING clause
The ROLLUP feature
Sorting with the ORDER BY clause

Reading: Chapter 4 (Teach Yourself SQL in One Hour a Day)
[Week 2] 5 Introduction to PHP.
PHP variables.
Numeric and string operators.
Comparison and logical operators.
Working with Arrays.
Control Structure and Program Flow.
The if, while, for and each statements.

Reading: Chapter 1, 2 (PHP and MySQL Web Development)
[Week 2] 6 Working with Strings.
String Functions
Working with Numbers.
Number Functions
Working with Dates
Date Functions
Working with Arrays
Array Functions

Reading: Chapter 3, 4, 5 (PHP and MySQL Web Development)
[Week 3] 7 Creating database objects
What is a primary key?
What is a foreign key?
What is an index?
Creating tables
SQL data types
Adding a primary key
Adding constraints
Creating Indexes
Altering table definition
Droping tables

Reading: Chapter 9, 10, 15 (Teach Yourself SQL in One Hour a Day)
[Week 3] 8 Manipulating data in tables
Adding data with the INSERT statement
INSERT with a SELECT statement
Changing data with the UPDATE statement
UPDATE with a SELECT statement
Removing data with the DELETE statement
DELETE with a SELECT statement
The TRUNCATE statement
The REPLACE statement (MySql)

Reading: Chapter 11 (Teach Yourself SQL in One Hour a Day)
[Week 3] 9 Accessing HTML form data
The GET method
The POST method
Connecting to a database
Inserting, Updating & Deleting from databases
Querying databases

Reading: Chapter 11 (PHP and MySQL Web Development)
[Week 4] 10 Database Design
The Logical and Physical Model
Understanding data normalization
First normal form
Second normal form
Third normal form
Pros & cons of data normalization
Denormalizing data
Entiry relationships
One-to-one relationship
One-to-many relationship
Many-to-many relationship
Designing Self-join relationship

Reading: Chapter 8 (Teach Yourself SQL in One Hour a Day)
[Week 4] 11 HTTP - HyperText Transfer Protocol
The client request
The server response
The GET and POST methods
Accessing client headers
Creating and adding server headers

Reading: None
[Week 4] 12 What is WAMP, MAMP or LAMP?
Downloading and Installing WAMP
Launching WAMP Services
What is DocumentRoot?
Accessing Resources using Localhost
Using phpMyAdmin to manage a database
Configuring httpd.conf, php.ini and my.ini files

Reading: None

- Final Exam -
- Final Project due -

All contents © Sam Sultan.
For more information, send e-mail to: