|
Subject:
|
Shopping Cart Code incomplete
|
|
Posted By:
|
dipeshedesign
|
Post Date:
|
6/12/2008 5:24:26 PM
|
Hi,
Just to note I have tried the shopping cart example from chapter 08 and the cart.php code is incomplete and does not work. The <form> is not closed with a </form> and the select is also not closed with </select>.
But the main thing is that even after I fixed the code the 'update' cart does not post at all.
Wondering if you could provide any suggestions.
cheers.
|
|
Reply By:
|
tboronczyk
|
Reply Date:
|
7/3/2008 12:15:08 PM
|
It looks like the sprintf() that creates the necessary query is missing a formatting specifier. Using the inventory_process.php script from the downloadable source files as a reference, the statement that starts on line 133 should read:
$query = sprintf('INSERT INTO %sSHOP_INVENTORY (ITEM_NAME, ' .
'ITEM_DESCRIPTION, PRICE, ITEM_IMAGE, CATEGORY_ID) VALUES ' .
'("%s", "%s", %02f, "%s", %d)',
DB_TBL_PREFIX,
mysql_real_escape_string($_POST['name'], $GLOBALS['DB']),
mysql_real_escape_string($_POST['description'], $GLOBALS['DB']),
$_POST['price'],
mysql_real_escape_string($_POST['image'], $GLOBALS['DB']),
$_POST['cat_id']);
-Tim
|