PHP and MySQL®
Private Training

Course Summary

In this intensive, hands-on PHP training course, students will learn to create database-driven websites using PHP and MySQL. Students will first learn the basics of PHP including syntax, flow control, string manipulation, and functions. Next, the course turns to database topics with several chapters on SQL basics followed by content on how to integrate PHP with the database. Regular Expressions are covered next to give students the tools they need for advanced form validation. Then, students will learn to track users as they move from page to page within a web site using PHP session variables. Finally, they will learn to manipulate files and send emails using built-in PHP functions.

Audience
Programmers who want to learn PHP.
Course Length
4 Days
Prerequisites
HTML experience is required. Programming experience in a high-level language is required. Basic CSS knowledge is helpful.

Objectives

Write PHP scripts using all the major features of the language.

Control the flow of program execution.

Use indexed and associative arrays to store sets of values.

Process and validate HTML forms.

Work with PHP’s built-in string manipulation functions.

Write reusable files and include them in multiple pages.

Define functions to create more manageable PHP applications.

Create SQL Select, Insert, and Update statements.

Integrate PHP with a database to create reports and insert and update records.

Use the PEAR DB package as a database abstraction layer.

Use PHP regular expressions for advanced form validation.

Use session variables to create site-wide user authentication and cookies to remember visitors between visits.

Send email with PHP’s built in mail() function.

Read, write, and upload files.

Detailed Outline

  1. PHP Basics
    • How PHP Works
    • The php.ini File
    • PHP Tags
    • PHP Statements and Whitespace
    • Comments
    • PHP Functions
    • Variable Types
    • Variable Names (Identifiers)
    • Type Strength
    • Variable Scope
    • Superglobals
    • Constants
    • Variable Testing and Manipulation Functions
    • PHP Operators
    • Single Quotes vs. Double Quotes
  2. Flow Control
    • Conditional Processing
    • If Conditions
    • Loops
    • while
    • do…while
    • for
    • break and continue
  3. Arrays
    • Enumurated Arrays
    • Initializing Arrays
    • Appending to an Array
    • Reading from Arrays
    • Looping through Arrays
    • Associative Arrays
    • Initializing Associative Arrays
    • Reading from Associative Arrays
    • Looping through Associative Arrays
    • Superglobal Arrays
    • Two-dimensional Arrays
    • Reading from Two-dimensional Arrays
    • Looping through Two-dimensional Arrays
    • Array Manipulation Functions
  4. PHP and HTML Forms
    • How HTML Forms Work
    • A Sample HTML Form
    • Form Variables
  5. String Manipulation
    • Concatenation
    • String Manipulation Functions
    • Examples of String Functions
    • Magic Quotes
    • magic_quotes_gpc
    • magic_quotes_runtime
    • Recommendation on Magic Quotes
  6. Reusing Code and Writing Functions
    • Including Files
    • require
    • require_once
    • include_path directive
    • auto_prepend_file and auto_append_file
    • User Functions
    • Defining Calling Functions
    • Default Values
    • Variable Scope
    • By Reference vs. By Value
    • Form Processing
    • Code Organization
  7. Simple SELECTs
    • Introduction to the Northwind Database
    • Comments
    • Whitespace and Semi-colons
    • Case Sensitivity
    • SELECTing All Columns in All Rows
    • SELECTing Specific Columns
    • Sorting By a Single Column
    • Sorting By Multiple Columns
    • Sorting By Column Position
    • Ascending and Descending Sorts
    • The WHERE Clause and Operator Symbols
    • Checking for Equality
    • Checking for Inequality
    • Checking for Greater or Less Than
    • Checking for NULL
    • WHERE and ORDER BY
    • The WHERE Clause and Operator Words
    • The BETWEEN Operator
    • The IN Operator
    • The LIKE Operator
    • The NOT Operator
    • AND
    • OR
    • Order of Evaluation
  8. Subqueries, Joins and Unions
    • Subqueries
    • Joins
    • Table Aliases
    • Multi-table Joins
    • Outer Joins
    • Unions
    • UNION ALL
    • UNION Rules
  9. Inserting, Updating and Deleting Records
    • INSERT
    • UPDATE
    • DELETE
  10. Managing Data
    • Querying a Database
    • mysqli() Overview
    • mysqli Methods and Properties
    • Inserting and Updating Records
    • mysqli Prepared Statements
  11. MDB2
    • Advantages and Disadvantages of MDB2
    • Why use a database abstraction layer?
    • When not to use a database abstraction layer?
    • Using MDB2
  12. Authentication with PHP and SQL
    • A Database-less Login Form
  13. Regular Expressions
    • preg_match()
    • preg_replace()
    • Regular Expression Tester
    • Regular Expression Syntax
    • Start and End ( ^ $ )
    • Number of Occurrences ( ? + * {} )
    • Common Characters (. \d \D \w \W \s \S)
    • Grouping ( [] )
    • Negation ( ^ )
    • Subpatterns ( () )
    • Alternatives ( | )
    • Escape Character ( \ )
    • Form Validation Functions with Regular Expressions
  14. Session Control and Cookies
    • Sessions
    • Configuring Sessions
    • Session Functions
    • Cookies
  15. Sending Email with PHP
    • mail()
    • Shortcomings of mail()
    • PHPMailer
  16. File System Management
    • Opening a File
    • Reading from a File
    • Writing to a File
    • File Locking
    • Uploading Files via an HTML Form
    • Getting File Information
    • More File Functions
    • Directory Functions