Get Beginning PHP Apache MySQL web development Michael K. Glass free all chapters
Get Beginning PHP Apache MySQL web development Michael K. Glass free all chapters
com
https://ebookname.com/product/beginning-php-apache-mysql-
web-development-michael-k-glass/
OR CLICK BUTTON
DOWNLOAD EBOOK
Sams Teach Yourself PHP MySQL and Apache All in One Julie
C. Meloni
https://ebookname.com/product/sams-teach-yourself-php-mysql-and-
apache-all-in-one-julie-c-meloni/
ebookname.com
https://ebookname.com/product/beginning-php-and-mysql-from-novice-to-
professional-third-edition-w-jason-gilmore/
ebookname.com
https://ebookname.com/product/developing-web-applications-with-apache-
mysql-memcached-and-perl-1-original-edition-patrick-galbraith/
ebookname.com
https://ebookname.com/product/membrane-trafficking-second-edition-bor-
luen-tang-eds/
ebookname.com
Housing Policy An Introduction 4th Edition Paul Balchin
https://ebookname.com/product/housing-policy-an-introduction-4th-
edition-paul-balchin/
ebookname.com
https://ebookname.com/product/secrets-of-a-serial-entrepreneur-a-
business-dragon-s-guide-to-success-1st-edition-shaf-rasul/
ebookname.com
https://ebookname.com/product/the-prophet-of-yonwood-jeanne-duprau/
ebookname.com
https://ebookname.com/product/stripes-and-java-web-development-is-fun-
again-1st-edition-frederic-daoud/
ebookname.com
A Great Rural Sisterhood Madge Robertson Watt and the ACWW
1st Edition Linda M. Ambrose
https://ebookname.com/product/a-great-rural-sisterhood-madge-
robertson-watt-and-the-acww-1st-edition-linda-m-ambrose/
ebookname.com
Beginning PHP, Apache,
MySQL® Web Development
Michael Glass
Yann Le Scouarnec
Elizabeth Naramore
Gary Mailer
Jeremy Stolz
Jason Gerner
Beginning PHP, Apache,
MySQL® Web Development
Beginning PHP, Apache,
MySQL® Web Development
Michael Glass
Yann Le Scouarnec
Elizabeth Naramore
Gary Mailer
Jeremy Stolz
Jason Gerner
Beginning PHP, Apache, MySQL® Web Development
Published by
Wiley Publishing, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2004 by Michael Glass, Yann Le Scouarnec, Elizabeth Naramore, Gary Mailer, Jeremy
Stolz, and Jason Gerner
Published by Wiley Publishing, Inc., Indianapolis, Indiana
Published simultaneously in Canada
Library of Congress Control Number: 2004101426
ISBN: 0-7645-5744-0
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
1MA/SV/QS/QU/IN
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form
or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as per-
mitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior writ-
ten permission of the Publisher, or authorization through payment of the appropriate per-copy fee to
the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978)
646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley
Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4447,
E-Mail: [email protected].
LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESEN-
TATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF
THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WAR-
RANTIES OF FITNESS FOR A PARTICULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY
SALES OR PROMOTIONAL MATERIALS. THE ADVICE AND STRATEGIES CONTAINED HEREIN MAY NOT BE
SUITABLE FOR EVERY SITUATION. THIS WORK IS SOLD WITH THE UNDERSTANDING THAT THE PUBLISHER IS
NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFESSIONAL SERVICES. IF PROFES-
SIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENT PROFESSIONAL PERSON SHOULD BE
SOUGHT. NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BE LIABLE FOR DAMAGES ARISING HEREFROM.
THE FACT THAT AN ORGANIZATION OR WEBSITE IS REFERRED TO IN THIS WORK AS A CITATION AND/OR A
POTENTIAL SOURCE OF FURTHER INFORMATION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER
ENDORSES THE INFORMATION THE ORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT
MAY MAKE. FURTHER, READERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY
HAVE CHANGED OR DISAPPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ.
For general information on our other products and services or to obtain technical support, please con-
tact our Customer Care Department within the U.S. at (800) 762-2974, outside the U.S. at (317)
572-3993 or fax (317) 572-4002.
Wiley also publishes its books in a variety of electronic formats. Some content that appears in print
may not be available in electronic books.
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related
trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in
the United States and other countries, and may not be used without written permission. MySQL is a
registered trademark of MySQL AB Company. All other trademarks are the property of their respective
owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.
About the Authors
Thanks, Staci, for putting up with long and late hours at the computer. Elizabeth and Jason, it wouldn’t
have been the same project without you two. And thanks to my code testers at www.ultimatespin.com:
Spidon, Kaine, Garmy, Spidermanalf, Ping, Webhead, and FancyDan. You guys rock!
To Donna and Gerry, who have influenced my life more than they can ever know, and who taught me
the importance of finishing what you’ve started.
I thank all the innocent bystanders who got pushed around because of this project: Debra and Nancy,
who were patient enough not to have homicidal thoughts; and my wife and kids, who barely saw me for
six months.
Elizabeth Naramore
Elizabeth has been programming with computers since a very young age, and, yes, she remembers when
software was packaged on cassette tapes. Graduating from Miami University at age 20 with a degree in
Organizational Behavior, she found a world of opportunity awaiting her—in corporate marketing. Her
first love was always computers, however, and she found herself sucked back to the programming world
in 1997 through Web site design and development (once a computer geek, always a computer geek).
While she plans to return to Miami to get her Masters in Computer Science, she currently stays busy run-
ning several Web sites. Her main focus is in e-commerce and running www.giftsforengineers.com.
Elizabeth has spent the past six years developing Web sites and coordinating all phases of Web site pub-
lication and production. She is currently a moderator at PHPBuilder.com, an online help center for PHP.
Her other interests include poetry, arts and crafts, camping, and juggling the many demands of career,
family, and the “other duties as assigned” that come along in life. She lives in Cincinnati, Ohio, with her
husband, beautiful daughter, and a new baby on the way.
Gary “trooper” Mailer
After graduation from university in 1998, Gary worked in a major software house in central London as a
quality assurance engineer, and also as the departmental Web developer (using ASP). This gave him a
taste of Web development. After a few years, he made the jump into full-time Web development and has
not looked back since.
Gary has worked in a few different sectors, including communications (Siemens) and hotels (Hilton), as
well as in “traditional” development houses.
He is currently a freelance developer for a European communications company. Gary has been and con-
tinues to be an active member of and contributor to the PHPBuilder.com site.
Thanks to my employer and colleagues for giving me the time and space to participate in this project.
Also, thanks to Debra Williams Cauley at Wiley for getting me involved in this project for Wrox.
I dedicate this book to my wife and family for helping me get through the long hours of preparation and
writing.
Introduction 1
x
Contents
While You’re Here . . . 79
Try It Out: Using the while Function 80
Alternate Syntax for PHP 83
Alternates to the <?php and ?> php Tags 83
Alternates to the echo Command 83
Alternates to Logical Operators 84
Alternates to Double Quotes: Using heredoc 84
Alternates to Incrementing Values 84
Summary 84
Exercises 85
xi
Contents
Who’s the Master? 120
Try It Out: Adding Links to the Table 120
Try It Out: Adding Data to the Table 122
Try It Out: Calculating Movie Takings 123
Try It Out: Displaying the New Information 124
Try It Out: Displaying Movie Details 126
A Lasting Relationship 128
Try It Out: Creating and Filling a Movie Review Table 128
Try It Out: Querying for the Reviews 129
Try It Out: Displaying the Reviews 131
Summary 133
Chapter 5: Form Elements: Letting the User Work with Data 135
Your First Form 136
Try It Out: Say My Name 136
FORM Element 138
INPUT Element 139
Processing the Form 140
Driving the User Input 141
Try It Out: Limiting the input choice 141
INPUT Checkbox Type 144
One Form, Multiple Processing 145
Try It Out: Radio Button, Multi-Line List Boxes 145
Radio INPUT Element 149
Multiple Submit Buttons 150
Basic Input Testing 150
Dynamic Page Title 151
Manipulating a String as an Array to Change the Case of the First Character 151
Ternary Operator 151
Using Them All 152
Try It Out: Hidden and password input 152
The Skeleton Script 160
Default Response 160
Adding Items 160
Summary 161
xii
Exploring the Variety of Random
Documents with Different Content
It was still well short of supper-time, and so they stopped at Bob’s
to see the tennis-court. The surface layer was almost finished, and
two sturdy posts for the net, startlingly, shiningly green, had been
sunk. While they admired, Mr. Starling joined them from the house,
and Laurie thanked him for his assistance with the quarry company.
“Glad to have helped, Laurie,” replied Bob’s father. “And that
reminds me. Seen the pear-trees?”
“Pear-trees? No, sir. Not to—to notice them.”
“Come and look at them.” Mr. Starling led Laurie around the corner
of the new court and along the further walk to where a few fruit-trees,
their branches still bare, occupied one corner of the garden. Laurie
viewed the trees interestedly, but failed to note anything remarkable,
and he turned to his guide for enlightenment. Mr. Starling was
selecting two bills from a long black wallet, keeping his back to the
others. He thrust the bills into Laurie’s hand.
“We’d like to help a little, my sister and I,” he said. “Use that in any
way you like, Laurie, but you needn’t say where it came from. If you
need more, let me know.”
“But we don’t really need it, sir,” protested the boy. “We’ve got
twelve dollars, and I don’t believe—”
“Put it in your pocket,” insisted Mr. Starling. “You can find some
way of using it for Miss Comfort’s—er—comfort!” He raised his voice.
“Look promising, don’t they? Lots of fruit this year, I guess. Thomas
is quite a gardener, if you take his word for it.” He turned Laurie
about with a hand on his shoulder and paced back toward the
others. “We feel sort of sorry for that little woman,” he added,
lowering his voice again. “Hard to pull up stakes at her age, I guess.
Ought to do what we can for her, Laurie. Come to me again if you
need some more.”
At supper Dr. Hillman asked the twins to come to his study, and
there he produced a pink slip of paper from a desk drawer and
handed it to Laurie. “My sister and I have wanted to help ever since
we first learned of Miss Comfort’s—ah—embarrassment, but have
been somewhat at a loss to know how to do so. She is greatly
averse to anything resembling charity, as you probably know. To-day
we heard of your interest in the matter, Laurence, and of your—ah—
ingenious solution of the lady’s problem, and it occurred to us that if
we handed a small contribution to you you would doubtless be able
to use it to advantage and at the same time—ah—consider it
confidential.”
“Twenty-five more!” exclaimed Laurie when they were back in No.
16. “Forty from Mr. Starling. Seventy-seven in all! What’ll we do with
it?”
“Blessed if I know!” replied Ned, “unless we install steam heat and
open plumbing!”
CHAPTER XVIII
MISS COMFORT COMES ABOARD