|This document is available in: English Castellano Deutsch Francais Italiano Nederlands Portugues Russian Turkce
by Alessandro Pellizzari
About the author:
Alessandro has been a Linux System Administrator and Programmer for some time, after using various Amiga computers with satisfaction. He is mainly interested in PHP, Python and C programming but always seeking new interesting fields in computer science.
Bookreview: Beginning PHP4 Databases
This article is a review of the new Wrox book on implementing and using
database systems with PHP4.
Nowadays the majority of PHP web sites are based upon one or several databases. But how many of the programmers really know how a relational database work, the possibilities they offer, how to optimize data access time and the object-relational extensions?
This book is a good starting point for programmers wanting to develop database-oriented web applications, to provide the reader the necessary foundations to choose the database to use and the techniques to choose the best table structure and access methods.
The book is composed of 13 chapters and 3 appendices, plus a fourteenth chapter available online at Wrox.
After a brief introduction to the book explaining the structure and listing the online resources, the first chapter is a fast introduction to PHP, deeply analyzing only the object-oriented part of the language. The second chapter focuses on database fundamentals, explaining various DB models and their evolution through history, to come to the modern RDBMS, their object-extensions and the XML databases. This chapter continues touching upon how to access databases with PHP, listing the supported databases and the PHP compile-time options to support them.
Starting from chapter three the book goes into database structure, explaining table normalization and giving a brief introduction to Entity-Relation diagrams, to come on chapters four and five to a deeper explanation of SQL respectively describing structure creation and data insertion, modification and querying. The sixth chapter finally introduces typical RDBMS characteristics as referential integrity, triggers and transactions.
Chapter seven goes back to PHP programming with a discussion on how to integrate advanced SQL into PHP scripts, describing, among others, cursors, triggers, views and indexes. On chapter eight we find an introduction to multi-tier development with PHP and an analysis of the available function and classes libraries abstracting database access. Chapter nine goes into deeper explanation of PEAR::DB, which will be used in the rest of the book for all the examples.
Chapter ten is entirely dedicated to a case study: a PEAR:DB-based application for invoice recording and payment-tracking, starting from the analysis of the problem, going through required tables definition and finally writing the application code.
The following chapter is similarly structured, studying a library management application, using object-relational databases, particularly PostgreSQL. It starts analyzing the problem, then defines the table structure, but the application code, due to space limitation, is only available from the Wrox website site.
From chapter twelve the argument shifts toward XML databases, listing pros and cons
in respect of relational DB. There in a list of different implementations, both
commercial and free, and in the end Xindice from Apache Software Foundation is discussed.
The explanation goes from the database creation to its filling using XML documents, analyzing then XPath and XUpdate technologies for data query and update, giving a brief introduction to the emerging XQuery.
Chapter thirteen takes from chapters ten and eleven its structure, studying from problem analysis to the realization a recipe exchange application, with privilege separation for normal user and administrator.
The appendices are mainly dedicated to database administration, data backup strategies, optimization, PHP DB access functions and Apache, PHP and iODBC installation under Linux/Unix.
The authors don't go too deep, as others do, into the syntax or a PHP introduction,
which can be better explained in dedicated books, and focus from the beginning on
the main subject: databases and PHP integration.
The example code is clear and well-commented both in-line and out-of-code.
Within the examples you will find useful tricks and tips.
The book site (see references at the end of the article) is really useful to find errata and to download the source code of all the book examples,and provides an example chapter to read.
There are some typos within the text, maybe annoying especially the non-English reader,
but they are not in the code, giving no problems with the examples.
On the book's web site you will find the errata with the corrections (see references at the end of the article).
There isn't (yet) "Professional PHP4 Databases", and for really special cases there is a need of deeper analysis of some arguments, that because of their complexity haven't been inserted into this book, given its "beginners"-oriented nature.
The book perfectly hits the bull's eye, a good base for the database usage in
PHP applications and good analysis techniques with regard to table structure.
A great number of the issues within the book are too often ignored by programmers, that would certainly give big advantages with regards to security, structure and speed.
This book is highly recommended reading for everyone wanting to begin using databases in PHP4 applications, but even and mainly to those already using them but not having received a good training on their efficient use.
Webpages maintained by the LinuxFocus Editor team
© Alessandro Pellizzari, FDL
2003-03-02, generated by lfparser version 2.35