Re: "PHP and MySQL Web Development" by Luke Welling and Laura Thomson
From: Jeffrey Silverman (jeffrey_at_jhu.edu)
Date: Thu, 25 Mar 2004 11:30:58 -0500
On Wed, 24 Mar 2004 23:58:51 +0000, Sheldon wrote:
> Thanks for your response. The problem is with the shopping cart in chapter
> 25, for which the code can be found in the examples directory on the CD.
> I've sorted the first problem by debugging, which turned out to be caused be
> a line which should have been commented out near the bottom of
> Another problem I've found now the cart page does display is that after
> adding something to the cart, and seeing the item in the cart, when then
> going to any other page the cart goes back to being empty. I think this is a
> reult of the session data not being saved.
> Any chance you could check the code on the CD to see if the problem is local
> to me or with the code on the CD. I've been through the code a couple of
> times but still can't see what could be causing the problem.
I'm probably not going to get a chance to look at the code samples any
time soon, sorry.
Although my cursory skim-through of the book shows the book to be an
adequate learning tool, I can't say for certain how good or bad the book
really is. My finding with books of this sort is that they may be good
for learning but I probably wouldn't want to use any of their code
verbatim in a production environment.
Also, the problem with books like this is that they are published once and
become outdated rather quickly. For example, on page 521, "Listing 25.2",
there is a use of the variable "$HTTP_SESSION_VARS". This array has
been supplanted, more recently, by the $_SESSION array. (In fact, this
happened not that recently, but in December of 2001!) This is just an
example, but a valid one, of how books may not always be the best sources
for code. (Actually, I'm surprised that the book uses the
HTTP_SESSION_VARS array -- the book's CD has PHP 4.3 on it!)
Look for "errata" for the book on the book publisher's website. Often the
errata will fix problems like the ones you are having.
-- Jeffrey D. Silverman | jeffrey AT jhu DOT edu Website | http://www.wse.jhu.edu/newtnotes/