with my shopping cart i can't seem to pass a particuler piece of information across. when the user clicks on the product to ad it does this
cart.php?action=add_item&id=<?php echo $row_Catalog['ItemID']; ?>&qty=1&id2=<?php echo $row_Catalog['ManName']; ?>
everything is working ok but i can;t seem to use the section where it is passing the ManName across.
so for each item there is a different ManName.
<?php require_once('Connections/RecordStorePHP.php'); ?>
<?php
mysql_select_db($database_RecordStorePHP, $RecordStorePHP);
$query_Recordset1 = "select * from cart";
$Recordset1 = mysql_query($query_Recordset1, $RecordStorePHP) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
include("db.php");
switch($_GET["action"])
{
case "add_item":
{
AddItem($_GET["id"], $_GET["qty"], $_GET["id2"]);
ShowCart();
break;
}
case "update_item":
{
UpdateItem($_GET["id"], $_GET["qty"], $_GET["id2"]);
ShowCart();
break;
}
case "remove_item":
{
RemoveItem($_GET["id"]);
ShowCart();
break;
}
default:
{
ShowCart();
}
}
function AddItem($itemId, $qty, $manName)
{
// Will check whether or not this item
// already exists in the cart table.
// If it does, the UpdateItem function
// will be called instead
global $dbServer, $dbUser, $dbPass, $dbName;
// Get a connection to the database
$cxn = @ConnectToDb($dbServer, $dbUser, $dbPass, $dbName);
// Check if this item already exists in the users cart table
$result = mysql_query("select count(*) from cart where cookieId = '" . GetCartId() . "' and itemId = $itemId");
$row = mysql_fetch_row($result);
$numRows = $row[0];
if($numRows == 0)
{
// This item doesn't exist in the users cart,
// we will add it with an insert query
@mysql_query("insert into cart(cookieId, itemId, qty) values('" . GetCartId() . "', $itemId, $qty)");
}
else
{
// This item already exists in the users cart,
// we will update it instead
UpdateItem($itemId, $qty);
}
}
i added the get statments ok but when i change the query to add it to the table it doesn;t work. can anyone help me please?