I have a db built with three columns
Code: Select all
disID (int) 11 = 1
disCode (varchar)200 = discount0001
disValue (varchar)200 = .10 (as %10)thanks
Moderator: General Moderators
Code: Select all
disID (int) 11 = 1
disCode (varchar)200 = discount0001
disValue (varchar)200 = .10 (as %10)Code: Select all
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) {
$updateSQL = sprintf("UPDATE LOTTIE_voucher SET vouchCode=%s WHERE vouchID=%s",
GetSQLValueString($_POST['vouchCode'], "text"),
GetSQLValueString($_POST['vouchID'], "int"));Code: Select all
<table align="left">
<tr>
<td>Voucher Code:</td>
<td><input type="text" name="vouchCode" value="<?php echo htmlentities($row_rsVoucher['vouchCode'], ENT_COMPAT, 'utf-8'); ?>" size="32" /></td>
<td><input type="submit" value="update" /></td>
</tr>
</table>Code: Select all
$XC_GranTotal = $XCart_sumTotal+$XC_SalesTax+$XC_Shipping-$XC_Discount;Code: Select all
<?php echo DoFormatCurrency($XC_GranTotal, 2, ',', '.', '£ ', ''); ?>yesThe cart information is being passed along somehow, right?
Code: Select all
// *** X Shopping Cart ***
$useSessions = true;
$XCName = "LottieCart";
$XCTimeout = 30;
$XC_ColNames=array("ProductID","Quantity","Name","Price","Stock","Total");
$XC_ComputedCols=array("","","","","","Price");
require_once('XCInc/XCart.inc');So what's the code for those pieces? For where the cart information is being saved, and the pages that show what's in the cart and the totals, and for what does billing?
Code: Select all
// *** Save XCart contents to table ***
require_once('XCInc/XCsaveAction.inc');
if (isset($_GET['XC_SaveCartToTable']) && ($_GET['XC_SaveCartToTable'] == "1")) {
$XC_destColName = array("ProductID","Quantity","","","","Total");
$XC_destColType = array("str","str","str","num","num","num");
$XC_orderId = $_SESSION['OrderID'];
$XC_tableName = "LOTTIE_orderdetails";
$XC_OrderIDCol = "OrderID";
$XC_OrderIDType = "num";
$XC_AddToTableRedirect = "../HostedSample/Process.php?$x_reqstr";
$XC_conName = "lotties";
require_once('XCInc/SaveXCartToTable.inc');
}
function DoFormatCurrency($num,$dec,$sdec,$sgrp,$sym,$cnt) {
setlocale(LC_MONETARY, $cnt);
if ($sdec == "C") {
$locale_info = localeconv();
$sdec = $locale_info["mon_decimal_point"];
$sgrp = $sgrp!="" ? $locale_info["mon_thousands_sep"] : "";
$sym = $cnt!="" ? $locale_info["currency_symbol"] : $sym;
}
$thenum = $sym.number_format($num,$dec,$sdec,$sgrp);
return $thenum;
}Code: Select all
mysql_select_db($database_lotties, $lotties);
$query_rsVoucher = "SELECT * FROM LOTTIE_vouchercode";
$rsVoucher = mysql_query($query_rsVoucher, $lotties) or die(mysql_error());
$row_rsVoucher = mysql_fetch_assoc($rsVoucher);
$totalRows_rsVoucher = mysql_num_rows($rsVoucher);
// voucher code
if (isset($_POST['vouchCode']) && $_POST['vouchCode'] == $row_rsVoucher['VCode']) {
$mycode = $row_rsVoucher['VCode'];
$spos = strpos($mycode, "%");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
$myvalue = $XCart_sumTotal * $myvalue / 100;
} else {
$spos = strpos($mycode, "£");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
}
}
$myTotal = $XCart_sumTotal - $myvalue;
$_SESSION['vouchCode'] = $myvalue;
} else unset($_SESSION['vouchCode']);Code: Select all
<td><input type="text" name="vouchCode" value="<?php echo @$_POST['vouchCode']; ?>" size="32" /></td>
<td><input type="submit" value="update" /></td>Code: Select all
<?php echo DoFormatCurrency($myvalue, 2, ',', '.', '£ ', ''); ?>it appears so. When a code that i have stored in the database is inputted it doesnt updateSo is the problem that none of the codes work?
Code: Select all
$query_rsVoucher = "SELECT * FROM LOTTIE_vouchercode";Code: Select all
mysql_select_db($database_lotties, $lotties);
$query_rsVoucher = "SELECT * FROM LOTTIE_vouchercode";
$rsVoucher = mysql_query($query_rsVoucher, $lotties) or die(mysql_error());
$row_rsVoucher = mysql_fetch_assoc($rsVoucher);
$totalRows_rsVoucher = mysql_num_rows($rsVoucher);Code: Select all
// voucher code
if (isset($_POST['vouchCode']) && $_POST['vouchCode'] == $row_rsVoucher['VCode']) {
$mycode = $row_rsVoucher['VCode'];
$spos = strpos($mycode, "%");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
$myvalue = $XCart_sumTotal * $myvalue / 100;
} else {
$spos = strpos($mycode, "£");
if ($spos !== false) {
$myvalue = substr($mycode, $spos+1);
}
}
$myTotal = $XCart_sumTotal - $myvalue;
$_SESSION['vouchCode'] = $myvalue;
} else unset($_SESSION['vouchCode']);