Building Database Applications on the Web Using PHP3
Authors: Craig Hilton and Jeff Willis
Price: $39.95 US
Reviewer: Gaelyne R. Gasson
This book begins with an upbeat preface about PHP3's ease of use for web applications. We're told it “emphasizes applications using PostgreSQL and MySQL, two powerful database management systems”. The preface suggests taking a 30-minute “test drive” on the book's accompanying web site; unfortunately, the site wasn't available as of this writing. A note indicated they had a hard drive crash and were rebuilding the system. [The site has since been restored, and everything works except the login. —Editor]
The first chapter is an overview of the book. Chapters 2 through 11 are referred to as background information relating to web-based technologies. Sample applications comprise Chapter 12, followed by a few pages of technical notes in Chapter 13. The reader is only one-third of the way through the book at this point and may be startled to find that a sixteen-page index for the PHP3 Language and a Function Reference make up the bulk of the remaining pages.
Two appendices are included. The first deals with CGI variables; the second concerns timing comparisons between MySQL and two different configurations of PostgreSQL. The reading list doesn't specifically deal with PHP, PostgreSQL or MySQL. The references listed are excellent material for general programming and web development, but the list is broad rather than specific to the topic of the book itself. There are two additional indexes in the back: one for alphabetically listed PHP3 functions and another for the book itself.
A CD-ROM with PHP3, PostgreSQL, the latest GPL version of MySQL, various RFC text files and W3C's HTML 3.2, 4.0 and CSS2 specifications comes with the book. According to a list in Chapter 1, the CD should also contain “all code built in this book”, but that wasn't the case. To be fair, the CD does include the full source for every version of PHP from v2.0 through v3.0.12 in tar.gz format and several Linux Red Hat RPMs for both PHP and PostgreSQL. It also has the PHP3 manual in several formats.
Generally, you would expect to read a discussion on the choice of operating system before reading about how to install software. However, UNIX (and more specifically, Linux) is covered briefly in chapter 7, “Why UNIX (Why not Windows?)”, while Chapter 1 describes how to install the supplied software from the CD.
Chapter 2 discusses PHP, and the next chapter offers a look at databases, SQL and PHP. This is followed by a brief chapter about UNIX (and Linux) and then a discussion of Internet and browser basics. Logically, one would have expected the flow to have been UNIX first (if at all), followed by Internet and browser basics, HTML, PHP and then databases.
The PostgreSQL chapter includes a chart comparing its features with other databases such as Oracle 8, Sybase 11 and MiniSQL. Strangely, the chart doesn't make any references to MySQL. The chapter also contains examples showing the syntax for connecting to a PostgreSQL database using PHP3 and how inserts and selections are made.
The chapter on MySQL seems to be missing some information. Instead of following the same pattern as the previous chapter, readers are given three short paragraphs about the history of MySQL and seven paragraphs discussing speed differences compared to PostgreSQL. If this were the beginning of the MySQL chapter and it carried on to cover connecting to MySQL databases and other MySQL information in a format similar to that of the PostgreSQL chapter, all would be well, but it's only a brief description of the software speed. Not even a look into the format of commands is offered. This wouldn't be an issue, except the preface of the book says it “emphasizes applications using PostgreSQL and MySQL.” Both database types should have been given the same type of coverage. As it is, MySQL could well have been “swept into” the short (three-page) Chapter 6, “Other SQL Databases”.
The PHP3 Language chapter is fairly detailed and uses several examples. Many of these contain humour to help teach functions and how they're used. The example used for classes was the most memorable for its humour. I found this chapter most informative, but wish more time had been spent on how classes are used in real-world applications.
Chapter 11 comes back to a fuller discussion of databases and SQL, as well as database design. There seems to be only brief coverage of column (field) types such as string, numeric, date, etc. used in databases, although each type is mentioned within the scope of examples given. A beginner's book on building database applications should have more information on this topic in order to explain the pros and cons for some of the more common choices available. I expected to see the examples in the format of PostgreSQL first, followed by MySQL to show similarities and important differences between the two types of databases, but this wasn't the case.
The applications include Hello World, File-Based Counter, Data-Based Counter, Real-Time Graphics, Jeff's Super Form (a web-to-e-mail form), Specific Form Processor (a web-to-e-mail form that stores information in a database), Querying Application and Login Authentication (in which users allowed to access a page are stored in a database).
The application section had numerous typos that hopefully will be removed in the next edition of the book. Moderately experienced readers should be able to catch most errors, but inexperienced users might not. For example, the text discussing the second application uses a different variable than was used in the “Complete Code” listing—$counter mysteriously changes to $tcounter two pages after the complete listing.
The Real Time Graphics application shows how to build a runtime graphic “button” using text based on the user's input. However, it's not fully explained that in order for this code to work, there must be an existing graphic (“image/logo1.gif”). Perhaps the authors assumed the code (and graphic) would be included on the CD. Once a suitable image file was mustered, the example code worked as described. Beginners may find this frustrating and give up before going further.
Again, all of the database applications are listed using PostgreSQL exclusively. This could be forgiven if the front of the book had listed only the one type of database. Trying to use the examples as given require numerous modifications when used with MySQL.
After each application, in a segment labeled “Troubleshooting”, readers are told “What can go wrong? About a million things” and “try your application directly on the Readers Only PHP3 Web Site”. The same paragraph is repeated word-for-word between each application. A short list of the most common types of errors would have been more appropriate.
The bulk of the book is the “Language and Function Reference for PHP3”, and as stated in the preface, this section isn't a repeat of the PHP3 manual. Items are listed by functional category, and each item includes a short example on how to use it. Where required, further information on the item is given in a clearly boxed area. It provides a convenient off-line reference for PHP3, and seems to have had a great deal of time and effort put into it.
Building Database Applications on the Web Using PHP3 doesn't live up to its title. It is a reasonable PHP3 reference, and it's nice to have this in a printed format. The writing style used is upbeat and pleasant, and the segments that cover detailed information are clear and understandable. The problem lies in the organization of the book, numerous typos and missing details.
Win an iPhone 6
Enter to Win
|Geek Hide-away in Guatemala - Stay for Free!||Nov 26, 2015|
|Microsoft and Linux: True Romance or Toxic Love?||Nov 25, 2015|
|Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.||Nov 24, 2015|
|Cipher Security: How to harden TLS and SSH||Nov 23, 2015|
|Web Stores Held Hostage||Nov 19, 2015|
|diff -u: What's New in Kernel Development||Nov 17, 2015|
- Microsoft and Linux: True Romance or Toxic Love?
- Geek Hide-away in Guatemala - Stay for Free!
- Cipher Security: How to harden TLS and SSH
- Non-Linux FOSS: Install Windows? Yeah, Open Source Can Do That.
- Web Stores Held Hostage
- Firefox's New Feature for Tighter Security
- PuppetLabs Introduces Application Orchestration
- It's a Bird. It's Another Bird!
- diff -u: What's New in Kernel Development
- IBM LinuxONE Provides New Options for Linux Deployment