About This E-Book
EPUB is an open, industry-standard format for e-books. However, support for EPUB and its many features varies across reading devices and applications. Use your device or app settings to customize the presentation to your liking. Settings that you can customize often include font, font size, single or double column, landscape or portrait mode, and figures that you can click or tap to enlarge. For additional information about the settings and features on your reading device or app, visit the device manufacturers Web site.
Many titles include programming code or configuration examples. To optimize the presentation of these elements, view the e-book in single-column, landscape mode and adjust the font size to the smallest setting. In addition to presenting code and configurations in the reflowable text format, we have included images of the code that mimic the presentation found in the print book; therefore, where the reflowable format may compromise the presentation of the code listing, you will see a Click here to view code image link. Click the link to view the print-fidelity code image. To return to the previous page viewed, click the Back button on your device or app.
Julie C. Meloni
SamsTeachYourself
PHP, MySQL & JavaScript
All in One
SIXTH EDITION
Sams Teach Yourself PHP, MySQL & JavaScript All in One, Sixth Edition
Copyright 2018 by Pearson Education, Inc.
All rights reserved. No part of this book shall be reproduced, stored in a retrieval system, or transmitted by any means, electronic, mechanical, photocopying, recording, or otherwise, without written permission from the publisher. No patent liability is assumed with respect to the use of the information contained herein. Although every precaution has been taken in the preparation of this book, the publisher and author assume no responsibility for errors or omissions. Nor is any liability assumed for damages resulting from the use of the information contained herein.
ISBN-13: 978-0-672-33770-3
ISBN-10: 0-672-33770-3
Library of Congress Control Number: 2017911865
Printed in the United States of America
0117
Trademarks
All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Pearson cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark.
Warning and Disclaimer
Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an as is basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the CD or programs accompanying it.
Special Sales
For information about buying this title in bulk quantities, or for special sales opportunities (which may include electronic versions; custom cover designs; and content particular to your business, training goals, marketing focus, or branding interests), please contact our corporate sales department at or (800) 382-3419.
For government sales inquiries, please contact .
For questions about sales outside the U.S., please contact .
Editor
Mark Taber
Managing Editor
Sandra Schroeder
Project Editor
Mandie Frank
Copy Editor
Bart Reed
Indexer
Erika Millen
Proofreader
Abby Manheim
Technical Editor
Timothy Boronczyk
Editorial Assistant
Vanessa Evans
Designer
Chuti Prasertsith
Compositor
codeMantra
Contents at a Glance
Table of Contents
Using click
to Change a
's
Appearance
About the Author
Julie C. Meloni is a technical consultant who has been developing web-based applications since the Web first saw the light of day. She has authored numerous books and articles on web-based programming and scripting languages and database topics, and you can find translations of her work in 18 different languages. She barely maintains a blog at thickbook.com, and can typically be found camping in national parks or cozying up to craft cocktail bars in and around Washington, D.C.
Acknowledgments
The Apache Software Foundation, the PHP Group, and MySQL AB deserve much more recognition than they ever get for creating these super products that drive the vast majority of the Web.
Accessing the Free Web Edition
Your purchase of this book in any format, print or electronic, includes access to the corresponding Web Edition, which provides several special online-only features to help you learn:
The complete text of the book
Updates and corrections as they become available
The Web Edition can be viewed on all types of computers and mobile devices with any modern web browser that supports HTML5.
To get access to the Web Edition of Sams Teach Yourself PHP, MySQL & JavaScript All in One, Sixth Edition, all you need to do is register this book:
Go to www.informit.com/register.
Sign in or create a new account.
Enter ISBN: 9780672337703.
Answer the questions as proof of purchase.
The Web Edition will appear under the Digital Purchases tab on your Account page. Click the Launch link to access the product.
Introduction
Welcome to Sams Teach Yourself PHP, MySQL & JavaScript All in One. This book takes the most useful parts of Sams Teach Yourself HTML, CSS & JavaScript All in One (Second Edition) and Sams Teach Yourself PHP, MySQL & 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 outputwhat it might look like on your screen.
The goal of this book is not to make you an expert in any one of these technologies but instead to give you a solid foundation in the skills you need to create modern, standards-compliant web applications. The following are of particular note:
Every example in this book is validated HTML5 and CSS3.
All the examples in the book have been tested for compatibility with the latest version of every major web browser. That includes Apple Safari, Google Chrome, Microsoft Internet Explorer, Mozilla Firefox, and Opera. Youll learn from the start to be compatible with the past, yet ready for the future.