Getting started with PHP and MySQL
Beginning custom dynamic web development
Do you want to learn basic dynamic web development but don’t know where to begin? Maybe you know a little about HTML and CSS, but the bigger picture eludes you. Or you want to connect your site's content to a database so that you can update it without having to change the code files. If so, this is the course for you.
In this hands-on four-hour course, Peter MacIntyre teaches you the ins and outs of PHP—one of the world's most popular web development languages—and details the interaction with databases it offers. Sign up to get hands-on experience using SQL database interaction and programming constructs, loops, and arrays as you explore this powerful language.
What you'll learn-and how you can apply it
By the end of this live, hands-on, online course, you’ll understand:
- What PHP is and how to use it
- How to use variables, arrays, and functions in PHP scripts
- How to interact with a MySQL database
And you’ll be able to:
- Process forms and validate submitted information
- Incorporate cookies and session variables in PHP scripts
- Add, update, and delete records in a MySQL database using PHP
This training course is for you because...
- You’re a frontend developer who wants to know what’s going on on the server side.
- You work with PHP-based websites, and you want to go deeper with database interaction.
- You want to become a PHP web developer.
- You want to build data-driven websites.
- A working knowledge of HTML and CSS scripting
- A basic understanding of computer programming
- A machine with either WAMP, XAMP, or MAMP installed, so you can get a web server with PHP running locally
About your instructor
Peter MacIntyre has over 28 years of experience in the information technology industry, primarily in the area of PHP and Web Technologies. He has contributed writing material for many IT industry publications: Author of "PHP: The Good Parts" (O’Reilly); co-author: Pro PHP Programming (APress), Programming PHP (3rd Edition - O’Reilly), Using Visual Objects, Using PowerBuilder 5, ASP.NET Bible, Web Warrior Survey on Web Development Languages, and Zend Studio for Eclipse Developer's Guide. Peter has another book covering WordPress that was published in May 2016.
Peter is a co-founder and past co-chair and past board member for the Northeast PHP Developer's Conference held in Boston, MA and Charlottetown, PE Canada for the last 6 years. Additionally, Peter has spoken several times at North American and International computer conferences including PHPCE 2017 in Warsaw, Poland; PHP[World] 2016 in Washington, DC; ZendCon 2016 in Las Vegas, NortheastPHP 2017 & 2016 (Charlottetown, PE, Canada), Prairie Dev Con 2016 in Winnipeg, MB, Canada, CA-World in New Orleans, USA; CA-TechniCon in Cologne, Germany; and CA-Expo in Melbourne, Australia.
The timeframes are only estimates and may vary according to how the class is progressing
Introduction (10 minutes)
- Presentation: Introduction to PHP
- Presentation: Competing technologies (.NET, JSP, Java, Python, Ruby)
Basic Web Concepts (25 minutes)
Presentation: The Operating System
Presentation: Apache Web Server
Code Text editors (Textpad, Vi, Zend, PHP Storm, etc)
Presentation: The PHP Environment - part 1
- The Client
Hands-on exercise #1: show phpinfo().
Language Basics (25 minutes)
- Presentation:<?php … ?> php tags, ending commands with ;
- Presentation: Ways to comment your code
- Presentation: Variables
- Presentation: Assignment Operators
- Presentation: Relational Operators
- Presentation: Data types
- Presentation: Echo & var_dump
- Presentation: Include / Require files
- Hands-on exercise #2: Create “Hello World” PHP code and server it locally
10 minute break
Logical Language Constructs (15 minutes)
- Presentation: If.. then .. else (elseif)
- Presentation: Switch.. case (break;)
- Presentation: Comparison ( = =)
- Hands-on exercise #3: use conditions to present different results based on server time being an odd or even number. Output: “The time is 99:99 am/pm, this is odd / even”
More Server Concepts (15 minutes)
- Presentation: $_POST
- Presentation: $_GET
- Presentation: $PHP_SELF
- Hands-on exercise #4: collect $_GET information from an embedded<a href> HTML tag
Flow Control (25 minutes)
- Presentation: Do While...
- Presentation: While…
- Presentation: For... Next / foreach
- Hands-on exercise #5: Design a form to calculate the amount of money you have in your change dish. Allow for the entry of pennies, nickels, dimes, quarters, 50-cent pieces, and dollar coins. Show the totals in both cents and dollars in a printable table. Also, provide a way to return to the coin entry page if necessary.
PHP Arrays & Functions (20 minutes)
- Presentation: Arrays – concepts
- Presentation: Arrays – creation
- Presentation: Arrays - management
- Presentation: Built in Functions – look at php.net
- Presentation: Rolling your own functions
10 minute break
Cookies & Sessions (25 minutes)
- Presentation: Why cookies
- Presentation: Setting cookies
- Presentation: GDPR (General Data Protection Regulation) awareness
- Presentation: Why Sessions
- Presentation: Setting sessions
- Presentation: $_SESSION
- Hands-on exercise #6: Build a form that collects name and phone number with separate area code filed, then process the information via the $_SESSION to determine what area code falls into a certain State based on the following chart:
Arizona (AZ) 480, 520, 602, 623, 928
Colorado (CO) 303, 719, 720, 970
Kansas (KS) 316, 620, 785, 913
Kentucky (KY): 270, 502, 606, 859
Oklahoma (OK) 405, 580, 918
Oregon (OR) 503, 541, 971
Dates and Times (15 minutes) - Presentation: UNIX Epoch - Presentation: Date functions - Presentation: Time functions - Hands-on exercise #7: Pick up “your” time of day and time zone (using the code from lab # 3 as a starting point if you want); Check your date.timezone value in php.ini; calculate and display the time of day in GMT - Q&A
Database Interaction (30 minutes)
- Presentation: SQL crash course
- Presentation: MySQLi
- Presentation: Connections
- Presentation: Sending Queries
- Presentation: Managing Results
- Presentation: phpMyAdmin tool
- Hands-on exercise #8: With provided addresses->names table: https://paladin-bs.com/addresses.sql
- Connect to Database (use require_once)
- Create a form to collect table information and save it to the database;
- Create another form to search the table based on any part of last name and display the results;
- Create a simple menu of links to trigger each of these actions
Course Wrap Up (5 minutes)
- Presentation: Other resources
- Presentation: Other O’Reilly Courses