Beginning PHP and PostgreSQL 8 delves into some of the most popular open-source web development technologies, the PostgreSQL 8 database server and PHP 5 scripting language. You’ll learn to reap the benefits of these core technologies by using them in unison to create dynamic, data-driven web applications. This is an ideal read if you are a web designer, programmer, hobbyist, or novice who wants to create applications with PHP 5 and PostgreSQL 8.
Le informazioni nella sezione "Riassunto" possono far riferimento a edizioni diverse di questo titolo.
W. Jason Gilmore is a web developer and business consultant with more than 15 years of experience helping companies large and small build amazing software solutions. He has been teaching developers from around the world about web development for over a decade, having written six books, including the bestselling Beginning PHP and MySQL, Fourth Edition and Easy PHP Websites with the Zend Framework, Second Edition .Over the years Jason has been published more than 300 times within popular publications such as Developer.com, PHPBuilder.com, JSMag, and Linux Magazine, and instructed hundreds of students in the United States and Europe. He s recently led the successful development and deployment of a 10,000+ product e-commerce project, and is currently working on a variety of new e-commerce initiatives. Jason is cofounder of the wildly popular CodeMash Conference, the largest multi-day developer event in the Midwest.
Beginning PHP
and PostgreSQL 8
From Novice to Professional
■ ■ ■
W. Jason Gilmore and Robert H. Treat
Beginning PHP and PostgreSQL 8: From Novice to Professional
Copyright © 2006 by W. Jason Gilmore
All rights reserved. No part of this work may be reproduced or transmitted in any form or by any means,
electronic or mechanical, including photocopying, recording, or by any information storage or retrieval
system, without the prior written permission of the copyright owner and the publisher.
ISBN-13 (pbk): 978-1-59059-547-3
ISBN-10 (pbk): 1-59059-547-5
Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1
Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence
of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark
owner, with no intention of infringement of the trademark.
Lead Editor: Matthew Moodie
Technical Reviewers: Greg Sabino Mullane, Matt Wade
Editorial Board: Steve Anglin, Dan Appleman, Ewan Buckingham, Gary Cornell, Jason Gilmore,
Jonathan Hassell, James Huddleston, Chris Mills, Matthew Moodie, Dominic Shakeshaft, Jim Sumser,
Matt Wade
Project Manager: Beth Christmas
Copy Edit Manager: Nicole LeClerc
Copy Editor: Bill McManus
Assistant Production Director: Kari Brooks-Copony
Production Editor: Laura Cheu
Compositor: Susan Glinert Stevens
Proofreader: Nancy Sixsmith
Indexer: John Collin
Artist: Kinetic Publishing Services, LLC
Cover Designer: Kurt Krames
Manufacturing Director: Tom Debolski
Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor,
New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ny@springer-sbm.com, or
visit http://www.springeronline.com.
For information on translations, please contact Apress directly at 2560 Ninth Street, Suite 219, Berkeley, CA
94710. Phone 510-549-5930, fax 510-549-5939, e-mail info@apress.com, or visit http://www.apress.com.
The information in this book is distributed on an “as is” basis, without warranty. Although every precaution
has been taken in the preparation of this work, neither the author(s) nor Apress shall have any liability to
any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly
by the information contained in this work.
The source code for this book is available to readers at http://www.apress.com in the Source Code section.
v
Contents at a Glance
About the Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
About the Technical Reviewers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxvii
Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxix
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxxi
■CHAPTER 1 An Introduction to PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
■CHAPTER 2 Installing and Configuring Apache and PHP . . . . . . . . . . . . . . . . . . . . 9
■CHAPTER 3 PHP Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
■CHAPTER 4 Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
■CHAPTER 5 Arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
■CHAPTER 6 Object-Oriented PHP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
■CHAPTER 7 Advanced OOP Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 157
■CHAPTER 8 Error and Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
■CHAPTER 9 Strings and Regular Expressions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 191
■CHAPTER 10 Working with the File and Operating System . . . . . . . . . . . . . . . . . 229
■CHAPTER 11 PEAR . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
■CHAPTER 12 Date and Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271
■CHAPTER 13 Forms and Navigational Cues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
■CHAPTER 14 Authentication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 325
■CHAPTER 15 Handling File Uploads . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
■CHAPTER 16 Networking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
■CHAPTER 17 PHP and LDAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 399
■CHAPTER 18 Session Handlers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
■CHAPTER 19 Templating with Smarty . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 447
■CHAPTER 20 Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 473
■CHAPTER 21 Secure PHP Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
■CHAPTER 22 SQLite . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 535
vi
■CHAPTER 23 Introducing PDO . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 555
■CHAPTER 24 Introducing PostgreSQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 573
■CHAPTER 25 Installing PostgreSQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 579
■CHAPTER 26 PostgreSQL Administration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 593
■CHAPTER 27 The Many PostgreSQL Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 611
■CHAPTER 28 From Databases to Datatypes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
■CHAPTER 29 Securing PostgreSQL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
■CHAPTER 30 PHP’s PostgreSQL Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 665
■CHAPTER 31 Practical Database Queries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 689
■CHAPTER 32 Views and Rules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 707
■CHAPTER 33 PostgreSQL Functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
■CHAPTER 34 PostgreSQL Triggers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 739
■CHAPTER 35 Indexes and Searching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
■CHAPTER 36 Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 765
■CHAPTER 37 Importing and Exporting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 777
■INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 787
Le informazioni nella sezione "Su questo libro" possono far riferimento a edizioni diverse di questo titolo.
EUR 9,51 per la spedizione da Regno Unito a U.S.A.
Destinazione, tempi e costiEUR 3,55 per la spedizione in U.S.A.
Destinazione, tempi e costiDa: Better World Books Ltd, Dunfermline, Regno Unito
Condizione: Good. 1st ed. Ships from the UK. Used book that is in clean, average condition without any missing pages. Codice articolo 1495040-6
Quantità: 1 disponibili
Da: HPB-Red, Dallas, TX, U.S.A.
paperback. Condizione: Acceptable. Connecting readers with great books since 1972. Used textbooks may not include companion materials such as access codes, etc. May have condition issues including wear and notes/highlighting. We ship orders daily and Customer Service is our top priority! Codice articolo S_315124011
Quantità: 1 disponibili
Da: Bay State Book Company, North Smithfield, RI, U.S.A.
Condizione: good. The book is in good condition with all pages and cover intact, including the dust jacket if originally issued. The spine may show light wear. Pages may contain some notes or highlighting, and there might be a "From the library of" label. Boxed set packaging, shrink wrap, or included media like CDs may be missing. Codice articolo BSM.HGKY
Quantità: 1 disponibili
Da: Lakeside Books, Benton Harbor, MI, U.S.A.
Condizione: New. Brand New! Not Overstocks or Low Quality Book Club Editions! Direct From the Publisher! We're not a giant, faceless warehouse organization! We're a small town bookstore that loves books and loves it's customers! Buy from Lakeside Books! Codice articolo OTF-S-9781590595473
Quantità: Più di 20 disponibili
Da: GreatBookPrices, Columbia, MD, U.S.A.
Condizione: New. Codice articolo 3511551-n
Quantità: Più di 20 disponibili
Da: BargainBookStores, Grand Rapids, MI, U.S.A.
Paperback or Softback. Condizione: New. Beginning PHP and PostgreSQL 8: From Novice to Professional 3.04. Book. Codice articolo BBS-9781590595473
Quantità: 5 disponibili
Da: Lucky's Textbooks, Dallas, TX, U.S.A.
Condizione: New. Codice articolo ABLING22Oct1111410213373
Quantità: Più di 20 disponibili
Da: GreatBookPrices, Columbia, MD, U.S.A.
Condizione: As New. Unread book in perfect condition. Codice articolo 3511551
Quantità: Più di 20 disponibili
Da: The Book Spot, Sioux Falls, MN, U.S.A.
Paperback. Condizione: New. Codice articolo Abebooks538279
Quantità: 1 disponibili
Da: Romtrade Corp., STERLING HEIGHTS, MI, U.S.A.
Condizione: New. Brand New. Soft Cover International Edition. Different ISBN and Cover Image. Priced lower than the standard editions which is usually intended to make them more affordable for students abroad. The core content of the book is generally the same as the standard edition. The country selling restrictions may be printed on the book but is no problem for the self-use. This Item maybe shipped from US or any other country as we have multiple locations worldwide. Codice articolo ABNR-210060
Quantità: 2 disponibili