1. Trang chủ
  2. » Công Nghệ Thông Tin

Beginning PHP5, Apache, and MySQL Web Development split phần 1 doc

82 358 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 82
Dung lượng 1,85 MB

Nội dung

Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Beginning PHP5, Apache, and MySQL ® Web Development Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass 01_579665 ffirs.qxd 12/30/04 8:08 PM Page iii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 01_579665 ffirs.qxd 12/30/04 8:08 PM Page ii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Beginning PHP5, Apache, and MySQL ® Web Development 01_579665 ffirs.qxd 12/30/04 8:08 PM Page i Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 01_579665 ffirs.qxd 12/30/04 8:08 PM Page ii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Beginning PHP5, Apache, and MySQL ® Web Development Elizabeth Naramore, Jason Gerner, Yann Le Scouarnec, Jeremy Stolz, Michael K. Glass 01_579665 ffirs.qxd 12/30/04 8:08 PM Page iii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Beginning PHP5, Apache, and MySQL ® Web Development Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2005 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 0-7645-7966-5 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 1B/SQ/QR/QV/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 permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written 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-4355, e-mail: brandreview@wiley.com. LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CONTENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTIC- ULAR PURPOSE. NO WARRANTY MAY BE CREATED OR EXTENDED BY SALES OR PROMO- TIONAL 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 PRO- FESSIONAL SERVICES. IF PROFESSIONAL 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 contact 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. Library of Congress Cataloging-in-Publication Data available from the publisher. Trademarks: Wiley, the Wiley Publishing 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 affil- iates, in the United States and other countries, and may not be used without written permission. MySQL is a registered trademark of MySQL AB Limited Company. All other trademarks are the prop- erty of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. 01_579665 ffirs.qxd 12/30/04 8:08 PM Page iv Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com About the Authors Elizabeth Naramore Elizabeth graduated from Miami University (Ohio) with a degree in Organizational Behavior and has been a Web developer since 1997. Her main focus is in e-commerce, but she develops sites across numer- ous industries. She is currently a moderator at PHPBuilder.com, an online help center for PHP. She lives in Cincinnati, Ohio with her husband and two children, and looks forward to someday returning to Miami to get her Masters in Computer Science. Thanks to my husband and soul mate who continues to be supportive of everything I do, and who inspires me to always do a little better. Thanks to my children who make me understand the importance of looking outside the box and keeping my sense of humor, and for making me proud to be a mom. Also, thank you to Debra for always keeping us on track, and for having faith in us. Jason “goldbug” Gerner Jason currently spends his days working as a Web developer in Cincinnati and burns free time com- plaining about lack of support for Web standards and abusing XML. He can often be found lurking in the PHPBuilder.com discussion forums, waiting to chime in with nagging comments about CSS or code efficiency. Yann “Bunkermaster” Le Scouarnec Yann is the senior developer for Jolt Online Gaming, a British gaming company. He is a moderator at PHPBuilder.com and a developer of open source PHP software for the gaming community. He has also worked for major software corporations as a software quality expert. 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. Jeremy “stolzyboy” Stolz Jeremy is a Web Developer at J&M Companies, Inc. (www.jmcompanies.com), a print company in Fargo, North Dakota. Jeremy is primarily a PHP/MySQL developer, but he has also worked with many other languages. When not working, he frequents the Internet and tries to keep his programming skills sharp and up to date. He is a contributor to and moderator at PHPBuilder.com. I’d like to thank my wife, my baby daughter, and the rest of my family for being patient with me while working on this project. 01_579665 ffirs.qxd 12/30/04 8:08 PM Page v Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Michael “BuzzLY” Glass Michael Glass has been a gladiator in the software/Web site development arena for more than eight years. He has more than ten years of commercial programming experience with a wide variety of tech- nologies, including PHP, Java, Lotus Domino, and Vignette StoryServer. He divides his time between computer programming, playing pool in the APA, and running his Web site at www.ultimatespin.com. You can usually find him slinking around on the PHPBuilder.com forums, where he is a moderator with the nickname BuzzLY. 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. 01_579665 ffirs.qxd 12/30/04 8:08 PM Page vi Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Credits Acquisitions Editor Debra Williams Cauley Development Editor Brian MacDonald Senior Production Editor Angela Smith Technical Editor Jason Gerner Copy Editor Kim Cofer Editorial Manager Mary Beth Wakefield Vice President & Executive Group Publisher Richard Swadley Vice President and Publisher Joseph B. Wikert Project Coordinator Erin Smith Graphics and Production Specialists Carrie A. Foster Denny Hager Jennifer Heleine Quality Control Technician Brian H. Walls Proofreading and Indexing TECHBOOKS Production Services 01_579665 ffirs.qxd 12/30/04 8:08 PM Page vii Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com [...]... Populating the Table Who’s the Master? 10 9 10 9 11 0 11 0 11 1 11 1 11 4 12 0 xi Contents Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com A Lasting Relationship Summary Exercises Chapter 5: Form Elements: Letting the User Work with Data Your First Form 12 8 13 4 13 4 13 5 13 6 FORM Element INPUT Element Processing the Form 13 8 13 9 14 0 Driving the User Input 14 1 INPUT Checkbox Type One Form, Multiple... Response Adding Items Summary Exercises 14 3 14 4 14 8 14 9 14 9 14 9 15 0 15 0 15 0 15 9 15 9 15 9 16 0 16 1 Chapter 6: Letting the User Edit the Database 16 3 Preparing the Battlefield Inserting a Simple Record from phpMyAdmin Inserting a Record in a Relational Database Deleting a Record Editing Data in a Record Summary Exercise 16 3 16 6 17 0 17 8 18 3 19 1 19 1 Chapter 7: Manipulating and Creating Images with PHP Working... 479 479 4 81 4 81 482 497 504 505 509 514 514 514 515 515 517 518 518 519 Shopping Cart Software Your Own Cart Software Code 519 519 E-Commerce, Any Way You Slice It 559 Information Is Everything Importance of Trust Privacy Policy Return Policy Warm Bodies Secure Credit Card Processing Professional Look 560 560 5 61 5 61 5 61 5 61 562 xv Contents Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com... Administrator Registration Summary Exercises Chapter 13 : Building a Content Management System Getting Your Users to Return 279 279 283 283 284 285 290 316 320 323 324 325 325 326 3 31 334 337 339 355 362 363 365 365 370 375 399 402 413 413 415 415 Content Management System Putting It All Together 415 416 416 416 Preparing the Database 417 xiv Contents Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com... Together 3 4 4 4 5 Apache PHP MySQL AMP Installers 6 6 7 8 Foxserv PHPTriad XAMPP 8 8 8 Configuring Your Apache Installation Testing Your Installation Customizing Your Installation Adding PHP to the Equation Document Root 8 9 10 10 11 Configuring Your PHP Installation 13 Testing Your Installation Customizing Your Installation Configuring PHP5 to Use MySQL 13 14 16 Configuring Your MySQL Installation Testing... Using heredoc Alternates to Incrementing/Decrementing Values OOP Dreams A Brief OOP Example Why Use OOP? Summary Exercises Chapter 3: Using PHP5 with MySQL Overview of MySQL Structure and Syntax MySQL Structure Field Types Choosing the Right Field Type null/not null Indexes Unique Auto Increment Other Parameters Types of MySQL Tables and Storage Engines MySQL Syntax and Commands How PHP Fits with MySQL. .. Commands How PHP Fits with MySQL Connecting to the MySQL Server Looking at a Ready-Made Database Querying the Database WHERE, oh WHERE Working with PHP and Arrays of Data: foreach A Tale of Two Tables 79 79 79 80 82 82 82 85 85 86 86 88 89 90 90 90 91 91 92 92 93 94 99 99 10 2 10 4 Referencing Two Tables Joining Two Tables 10 5 10 7 Helpful Tips and Suggestions 10 9 Documentation Using PHPMyAdmin Summary Exercises... Installation The my.cnf File Setting Up Users and Privileges Where to Go for Help and Other Valuable Resources Help within the Programs Source Web Sites Summary 17 17 19 21 24 25 25 25 26 Contents Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Part II: Movie Review Web Site 27 Chapter 2: Creating PHP Pages Using PHP5 29 Overview of PHP Structure and Syntax How PHP Fits with HTML The... Normalization 203 208 214 218 220 225 225 227 227 228 229 239 250 250 2 51 2 51 252 256 260 260 2 61 269 269 2 71 272 272 272 273 275 275 276 277 277 278 278 xiii Contents Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Designing Your Database Creating the First Table What’s So Normal About These Forms? Standardization Finalizing the Database Design Creating a Database in MySQL Creating... Images with PHP Working with the GD Library What File Types Can I Use with GD and PHP? Compiling PHP with GD Allowing Users to Upload Images xii 19 3 19 3 19 4 19 4 19 6 Contents Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com Converting Image File Types Black and White Adding Captions Adding Watermarks and Merging Images Creating Thumbnails Summary Exercises Chapter 8: Validating . http://www.simpopdf.com Beginning PHP5, Apache, and MySQL ® Web Development 01_ 579665 ffirs.qxd 12 /30/04 8:08 PM Page i Simpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com 01_ 579665 ffirs.qxd 12 /30/04. foreach 10 2 A Tale of Two Tables 10 4 Referencing Two Tables 10 5 Joining Two Tables 10 7 Helpful Tips and Suggestions 10 9 Documentation 10 9 Using PHPMyAdmin 10 9 Summary 11 0 Exercises 11 0 Chapter. Using Tables to Display Data 11 1 Creating a Table 11 1 Populating the Table 11 4 Who’s the Master? 12 0 02_579665 ftoc.qxd 12 /30/04 8:09 PM Page xi Simpo PDF Merge and Split Unregistered Version -

Ngày đăng: 13/08/2014, 12:21

TỪ KHÓA LIÊN QUAN