Peter, thanks for your reply.  I'm 100% unsure that register_globals is
turned on.  I've not tried any of your points as for some reason my code
works and my errors have somehow disappeared.  It simply doesn't make any
sense.  Although I did email my web host to see if register_globals were
turned on and they may have done this, but I'm thinking its not that as
nobody has got back to me.  I printed out the contents of the $buy variable
and it contained exactly  what I expected it to so it seems to be behaving
as it should, I'm just unsure as to why its working now - bizarre!  Even
when I passed the Catagory/Interests ID along with the product ID in the
URL, that still produced errors but I wasn't going to stay up any later to
try and solve it.  All I know is last night is didn't work and now it does !


Thanks again for your reply.

Graeme :)

----- Original Message -----
From: "Peter Beckman" <[EMAIL PROTECTED]>
To: "Boa Constructor" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Thursday, November 14, 2002 3:41 PM
Subject: Re: [PHP-DB] Shopping Cart Sessions - Think this is a simple
prolem- hopefully


> 1. Are you 100% sure register_globals is turned on?
> 2. You session_register your variable before you change it.  Replace
>     $ShoppingCart with $_SESSION[ShoppingCart] every time you use it.
This way
>     you are modifying the session variable actually in the session, not
just
>     the one time.
>
>    session_register() copies the named variable into the session space,
but
>    adding or removing items from that variable does NOT change it in the
>    session if you use _register.  If you modify $_SESSION[shoppingcart]
>    every time, then you are actually reading/writing to the real session
>    variable and don't have to worry about it.
>
> Peter
>
> On Thu, 14 Nov 2002, Boa Constructor wrote:
>
> > Evening all, I'm pretty stumped with this basic shopping cart I'm trying
> > to integrate into my site, if u wanna see what I'm on about visit
> > http://www.hostmaster-x.co.uk/Products.php.  On my products script I've
> > got the following:
> > [...]
> > Of course I need a link so that I can buy a product, so I've got the
following in a loop:
> > echo "<a href=$PHP_SELF?buy=$i>Buy</a><BR>";
> >
> > The link works fine for each product, the problem is that the ID of the
> > product doesn't seem to be stored in the session and I get a whole pile
> > of mysql errors which don't appear in the same page when products are
> > displayed.  The errors highlight the following code:
> >
> > while($ProductDetails = mysql_fetch_array($Q))
> > {
> > $ProductID = $ProductDetails["ID"];
> > $ProductName = $ProductDetails["ProductName"];
> > $SellingPrice = $ProductDetails["SellingPrice"];
> > $ProductPicture = $ProductDetails["PictureOfProduct"];
> > $AmountInStock = $ProductDetails["AmountInStock"];
> > $Description = $ProductDetails["ProductDescription"];
> > $PictureOfProduct = $ProductDetails["PictureOfProduct"];
> > }
> > if(mysql_num_rows($Q) > 0)
> >
> > Anyone got any ideas? I'm a bit lost as to why this doesn't work.
> >
> > G :)
>
> --------------------------------------------------------------------------
-
> Peter Beckman            Systems Engineer, Fairfax Cable Access
Corporation
> [EMAIL PROTECTED]
http://www.purplecow.com/
> --------------------------------------------------------------------------
-
>
>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to