Sams Teach Yourself PHP, MySQL, and JavaScript All-in-One

cover of Sams Teach Yourself PHP, MySQL, and JavaScript All-in-OneThe following information is for the 1st edition of this particular title, actually called the 6th edition on the printed book, published in 2017.

All the PHP code for this edition of the book is based on the latest version of PHP available at the time of writing (7.1.x in this case), although it is backwards-compatible to 5.6.x. This book takes the most useful parts of Sams Teach Yourself HTML, CSS, and JavaScript All in One (Second Edition) and Sams Teach Yourself PHP, MySQL, and Apache All in One (Fifth Edition), refreshes the content for the inevitable changes in technology that happen every day, and provides you with a foundation for “full stack” web application development.

This foundation is provided by example; this book scaffolds your understanding of HTML, CSS, JavaScript, and PHP (plus database interactivity with MySQL) by showing you code that builds upon other code, explaining the details of the code, and providing you with sample output—what it might look like on your screen.

Much like my other books, his book is not intended as the be-all and end-all of your education in this matter: it’s a first step, which will hopefully illuminate the pathways of all the other steps you will need to take to become an expert in these areas.

  • ISBN 0672337703, © Sams 2017
  • Get the source code at GitHub.
  • Translations: Chinese (Simplified), Serbian

Table of Contents

This is a pretty accurate table of contents of the current edition, give or take a sub-heading or two. Each chapter also has a summary, quiz questions, and one or more activities.


Chapter 1: Understanding How the Web Works

  • A Brief History of HTML and the World Wide Web
  • Creating Web Content
  • Understanding Web Content Delivery
  • Selecting a Web Hosting Provider
  • Testing with Multiple Web Browsers
  • Creating a Sample File
  • Using FTP to Transfer Files
  • Distributing Content without a Web Server
  • Tips for Testing Web Content

Chapter 2: Structuring HTML and Using Cascading Style Sheets

  • Getting Started with a Simple Web Page
  • HTML Tags Every Page Must Have
  • Using Hyperlinks in Web Pages
  • Organizing a Page with Paragraphs and Line Breaks
  • Organizing Your Content with Headings
  • Understanding Semantic Elements
  • How CSS Works
  • A Basic Style Sheet
  • A CSS Style Primer
  • Using Style Classes
  • Using Style IDs
  • Internal Style Sheets and Inline Styles

Chapter 3: Understanding the CSS Box Model and Positioning

  • The CSS Box Model
  • The Whole Scoop on Positioning
  • Controlling the Way Things Stack Up
  • Managing the Flow of Text
  • Understanding Fixed Layouts
  • Understanding Liquid Layouts
  • Creating a Fixed/Liquid Hybrid Layout
  • Considering a Responsive Design

Chapter 4: Introducing JavaScript

  • Learning Web Scripting Basics
  • How JavaScript Fits into a Web Page
  • Beginning the Script
  • Adding JavaScript Statements
  • Creating Output
  • Adding the Script to the Web Page
  • Exploring JavaScript’s Capabilities
  • JavaScript Syntax Rules
  • Using Comments
  • Best Practices for JavaScript
  • Understanding JSON
  • Using the JavaScript Console to Debug JavaScript

Chapter 5: Introducing PHP

  • How PHP Works with a Web Server
  • The Basics of PHP Scripts
  • Code Blocks and Browser Output


Chapter 6: Understanding Dynamic Web Sites & HTML5 Applications

  • Understanding the Different Types of Scripting
  • Displaying Random Content
  • Understanding the Document Object Model (DOM)
  • Using window Objects
  • Working with the document Object
  • Working with the location Object
  • More About the DOM Structure
  • Working with DOM Nodes
  • Hiding and Showing Objects
  • Modifying Text Within a Page
  • Adding Text to a Page
  • Changing Images Based on User Interaction
  • Debugging HTML & CSS Using Developer Tools
  • Using the JavaScript Console to Debug JavaScript
  • Thinking Ahead to Developing HTML5 Applications

Chapter 7: JavaScript Fundamentals: Variables, Strings, and Arrays

  • Using Variables
  • Understanding Expressions and Operators
  • Data Types in JavaScript
  • Converting Between Data Types
  • Using String Objects
  • Working with Substrings
  • Using Numeric Arrays
  • Using String Arrays
  • Sorting a Numeric Array

Chapter 8: JavaScript Fundamentals: Functions, Objects, and Flow Control

  • Using Functions
  • Introducing Objects
  • Using Objects to Simplify Scripting
  • Extending Built-in Objects
  • Using the Math Object
  • Working with Math Functions
  • Working with Dates
  • The if Statement
  • Using Shorthand Conditional Expressions
  • Testing Multiple Conditions with switch
  • Using for Loops
  • Using while Loops
  • Using do…while Loops
  • Working with Loops
  • Looping Through Object Properties

Chapter 9: Understanding JavaScript Event Handling

  • Understanding Event Handlers
  • Using Mouse Events
  • Using Keyboard Events
  • Using the onLoad and onUnload Events
  • Using onClick to Change <div> Appearance

Chapter 10: The Basics of Using jQuery

  • Using Third-Party JavaScript Libraries
  • jQuery Arrives on the Scene
  • Preparing to Use jQuery
  • Becoming Familiar with the $(document).ready Handler
  • Selecting DOM and CSS Content
  • Manipulating HTML Content
  • Putting the Pieces Together to Create a jQuery Animation
  • Handling Events with jQuery


Chapter 11: AJAX: Getting Started with Remote Scripting

  • Introducing AJAX
  • Using XMLHttpRequest
  • Creating a Simple AJAX Library
  • Creating an AJAX Quiz Using the Library
  • Debugging AJAX Applications
  • Using jQuery’s Built-in Functions for AJAX

Chapter 12: PHP Fundamentals: Variables, Strings, and Arrays

  • Understanding Variables and Data Types
  • Using Expressions and Operators
  • Understanding Arrays
  • Some Array-Related Constructs and Functions

Chapter 13: PHP Fundamentals: Functions, Objects, and Flow Control

  • Calling Functions
  • Using Built-in Functions
  • Defining a Function
  • Returning Values from User-Defined Functions
  • Understanding Variable Scope
  • Saving State Between Function Calls with the static Statement
  • More About Arguments
  • Testing for the Existence of a Function
  • Creating an Object
  • Object Inheritance
  • Switching Flow
  • Implementing Loops

Chapter 14: Working with Cookies and User Sessions

  • Introducing Cookies
  • Setting a Cooking
  • Deleting a Cookie
  • Overview of Server-Side Sessions
  • Working with Session Variables
  • Destroying Sessions and Unsetting Session Variables
  • Using Sessions in an Environment with Registered Users

Chapter 15: Working with Web-Based Forms

  • How HTML Forms Work
  • Creating a Form
  • Accepting Text Input
  • Naming Each Piece of Form Data
  • Exploring Form Input Controls
  • Using HTML5 Form Validation
  • Submitting Form Data
  • Accessing Form Input with User-Defined Arrays
  • Accessing Form Elements with JavaScript
  • Accessing Form Data with PHP
  • Using Hidden Fields to Save State in Dynamic Forms
  • Sending Mail on Form Submission


Chapter 16: Understanding the Database Design Process

  • The Importance of Good Database Design
  • Types of Table Relationships
  • Understanding Normalization
  • Following the Design Process

Chapter 17: Learning Basic SQL Commands

  • Learning the MySQL Data Types
  • Learning the Table Creation Syntax
  • Using the INSERT Statement
  • Using the SELECT Statement
  • Using WHERE in Your Queries
  • Selecting from Multiple Tables
  • Using the UPDATE Statement to Modify Records
  • Using the REPLACE Statement
  • Using the DELETE Statement
  • Frequently Used String Functions in MySQL
  • Using Date and Time Functions in MySQL

Chapter 18: Interacting with MySQL Using PHP

  • MySQL or MySQLi Functions?
  • Connecting to MySQL with PHP
  • Working with MySQL Data


Chapter 19: Creating a Simple Discussion Forum

  • Designing the Database Tables
  • Creating an Include File for Common Functions
  • Creating the Input Forms and Scripts
  • Displaying the Topic List
  • Displaying the Posts in a Topic
  • Adding Posts to a Topic

Chapter 20: Creating an Online Storefront

  • Planning and Creating the Database Tables
  • Displaying Categories of Items
  • Displaying Items

Chapter 21: Creating a Simple Calendar

  • Building a Simple Display Calendar
  • Creating a Calendar Library

Chapter 22: Managing Web Applications

  • Understanding Some Best Practices in Web Application Development
  • Writing Maintainable Code
  • Implementing Version Control in Your Work
  • Understanding the Value and Use of Coding Frameworks


Appendix A: Installation QuickStart with XAMPP

  • Installing XAMPP on Linux/UNIX
  • Installing XAMPP on Windows
  • Installing XAMPP on Mac OS X
  • Securing XAMPP
  • Troubleshooting

Appendix B: Installing and Configuring MySQL

  • How to Get MySQL
  • Installing MySQL on Linux/UNIX
  • Installing MySQL on Mac OS X
  • Installing MySQL on Windows
  • Troubleshooting Your Installation

Appendix C: Installing and Configuring Apache

  • Choosing the Appropriate Installation Method
  • Installing Apache on Linux/UNIX
  • Installing Apache on Mac OS X
  • Installing Apache on Windows
  • Apache Configuration File Structure
  • Apache Log Files
  • Apache-Related Commands
  • Starting Apache for the First Time
  • Troubleshooting

Appendix D: Installing and Configuring PHP

  • Building PHP on Linux/UNIX with Apache
  • Installing PHP on Mac OS X
  • Installing PHP on Windows
  • php.ini Basics
  • Testing Your Installation