PHPBuilder - I need help to solve this problem

RSS Twitter

I need help to solve this problem

by: Tabassum
April 24, 2006

Version: PHP4

Type: Sample Code (HOWTO)

Category: Shopping Carts

License: Other

Description: I am trying to make an ecommerce site and in addtobasket file I put following code to read the Quantities of the product but it keep sending this warning. I used same code 2 years back on PHP3 at that time it works but now its saying Warning: Variable passed to each() is not an array or object

$result = mysql ($conn, "SELECT PRODUCT_ID, QUANTITY FROM table_basket");

		while (list ($key, $value)= each ($QUANTITY) ) 
			if ($value == 0) continue;
			$query = "DELETE FROM $table_basket WHERE PRODUCT_ID = $key AND CUSTOMERID = $CustomerId";
			if (! $result) printf ("Error: %s<br>", mysql_error ());
			$query = "INSERT INTO $table_basket SET PRODUCT_ID = $key, QUANTITY = $value, CUSTOMERID = $CustomerId";
			if (! $result) printf ("Error: %s<br>", mysql_error ());

Comment and Contribute

Your comment has been submitted and is pending approval.




(Maximum characters: 1200). You have characters left.