Re: "PHP and MySQL Web Development" by Luke Welling and Laura Thomson

From: Jeffrey Silverman (jeffrey_at_jhu.edu)
Date: 03/25/04


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
> show_cart.php.
>
> 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.
>
> Sheldon

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/


Relevant Pages

  • Re: Creating a database driven website
    ... I'm trying to create a website for my lighting store where customers ... etc. and programming languages such as HTML and C++. ... I suggest you use an existing shopping cart program. ...
    (alt.html)
  • trouble with arrays
    ... I'm trying to modify a shopping cart script from Mastering PHP/MySQL and am ... The original code, below, ... stores the cart items in a session variable array ...
    (comp.lang.php)
  • Re: Not sure what to use for this
    ... There are two websites involved, ... and the website of the shopping cart service. ... > the service site, then after the service site adds the item to the cart, ... > Use cookies with javascript. ...
    (comp.lang.java.programmer)
  • Not sure what to use for this
    ... I have a requirement where I need to insert a cart contents into all the ... There are two websites involved, ... the service site, then after the service site adds the item to the cart, ... Use cookies with javascript. ...
    (comp.lang.java.programmer)
  • cart shop, forum and blog as one solution
    ... website based on CMS with forum, blog and cart solution. ...
    (comp.lang.php)