MySQL.Novice.to.Ninja.6th.Edition.0994346980.pdf

(4960 KB) Pobierz
SI
XT
H
ED
IT
IO
N
PHP & MYSQL:
BY
TOM BUTLER
&
KEVIN YANK
NOVICE TO NINJA
BUILD YOUR OWN POWERFUL WEB APPLICATIONS
i
PHP & MySQL: Novice to Ninja, 6th Edition
by Tom Butler and Kevin Yank
Copyright © 2017 SitePoint Pty. Ltd.
Product Manager:
Simon Mackie
English Editor:
Ralph Mason
Technical Editor:
Bruno Škvorc
Cover Designer:
Alex Walker
Notice of Rights
All rights reserved. No part of this book may be reproduced, stored in a retrieval system or
transmitted in any form or by any means, without the prior written permission of the
publisher, except in the case of brief quotations embodied in critical articles or reviews.
Notice of Liability
The author and publisher have made every effort to ensure the accuracy of the information
herein. However, the information contained in this book is sold without warranty, either
express or implied. Neither the authors and SitePoint Pty. Ltd., nor its dealers or
distributors will be held liable for any damages to be caused either directly or indirectly by
the instructions contained in this book, or by the software or hardware products described
herein.
Trademark Notice
Rather than indicating every occurrence of a trademarked name as such, this book uses the
names only in an editorial fashion and to the benefit of the trademark owner with no
intention of infringement of the trademark.
Published by SitePoint Pty. Ltd.
48 Cambridge Street Collingwood
VIC Australia 3066
Web: www.sitepoint.com
Email: books@sitepoint.com
ISBN 978-0-9943469-8-8 (print)
ISBN 978-0-9953827-8-7 (ebook)
Printed and bound in the United States of America
ii PHP & MySQL: Novice to Ninja, 6th Edition
About Tom Butler
Tom is a web developer, a Ph.D student researching software best practices, and
university lecturer from the UK with an interest in programming best practices,
separation of concerns and a “less is more” approach to code.
About Kevin Yank
Before joining Culture Amp in 2015, Kevin taught a generation of web developers
during his time at SitePoint, starting with the first edition of the book that you
now hold in your hands. While there, he helped to launch success stories like
99designs and Flippa. More recently, he quizzed web developers on HTML, CSS
and JavaScript by leading the team behind Sit the Test, and has spoken at tech
conferences around the world. On weekends he performs improvised theatre with
Impro Melbourne, which is a lot more like building websites than you might
expect.
About SitePoint
SitePoint specializes in publishing fun, practical, and easy-to-understand content
for web professionals. Visit http://www.sitepoint.com/ to access our blogs, books,
newsletters, articles, and community forums. You’ll find a stack of information on
JavaScript, PHP, Ruby, mobile development, design, and more.
Table of Contents iii
Table of Contents
Preface
...............................................................................xv
Who Should Read This Book
....................................................................xvi
Programming Has Changed
......................................................................xvi
It Takes 10,000 Hours to Become an Expert
.........................................xvii
Resist the Temptation to Skip Ahead
...................................................xviii
The Concorde Fallacy
...............................................................................xviii
You’re Not Learning PHP
..........................................................................xix
Getting Braces and Semicolons in the Right Place Is the Easy Part
.. xx
You Won’t Get Anything Done by Planning
........................................... xx
Conventions Used
................................................................................... xxiii
Supplementary Materials
........................................................................xxiv
Chapter 1
Installation
.................................................1
Your Own Web Server
.................................................................................. 3
Server Setup 1: Manually Installing All the Software
Components
........................................................................................ 4
Server Setup 2: Pre-packaged Installations
.................................. 5
Server Setup 3: Virtual Servers
........................................................ 6
iv PHP & MySQL: Novice to Ninja, 6th Edition
Your Own Virtual Server
.............................................................................. 8
Installation on Windows
................................................................... 8
Installation on macOS
....................................................................... 8
Installation on Linux
......................................................................... 9
Getting Started with Vagrant
..................................................................... 9
Chapter 2
Introducing PHP
....................................15
Basic Syntax and Statements
....................................................................18
Variables, Operators, and Comments
.......................................................22
Variables
............................................................................................22
Operators
...........................................................................................23
Comments
.........................................................................................23
Control Structures
......................................................................................24
If Statements
....................................................................................25
Loops
..................................................................................................33
Arrays
............................................................................................................45
User Interaction and Forms
.......................................................................52
Passing Variables in Links
...............................................................53
Passing Variables in Forms
.........................................................................62
GET or POST?
....................................................................................66
Hiding the Seams
........................................................................................66
Zgłoś jeśli naruszono regulamin