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:

<?php

$shoppingcart = array();

session_start();

session_register('shoppingcart');

if($buy != "")

{

$shoppingcart[] = $buy;

//header("Location: $PHP_SELF");

/*

echo "<B>Cart contains: <?=count($shoppingcart)?> items</B><BR><BR><BR>";

*/

//exit();

}

// Loads more code here ( code that works )


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 :)



Public Sub House()

On Error Resume drink

         If Pint.empty = True Then
                 Pint.refill
   Else
                 Pint.drink
         End if

stomach.add Pint

MsgBox " I've had .... " & stomach.count & " Pints"
MsgBox "VERY DRUNK"

End Sub

Reply via email to