Jump to content

jonnyfortis

Members
  • Posts

    41
  • Joined

  • Last visited

Everything posted by jonnyfortis

  1. i have a student register for attendance, down the side will be their names, across the top i will be showing each single day (example tuesday) from three month date range currently the code just echoes out all the Tuesdays as an array from the three month date range. i need to be able to use the individual date to add them to the database based on weather they student has attended. i know how to do this i just need to know how i can use the dates individually. function getDatesFromRange($start, $end) { $interval = new DateInterval('P1D'); $realEnd = new DateTime($end); $realEnd->add($interval); $period = new DatePeriod( new DateTime($start), $interval, $realEnd ); foreach($period as $date) { $array[] = $date->format('Y-m-d'); } return $array; } // Call the function $dates = getDatesFromRange('2016-04-01', '2016-07-01'); // Print the output print_r($dates);
  2. let me explain a little further. when i load the home1.php all the page shows up except the wordpress blog, that is not being included. i am not using wordpress as an editor. this was something built by someone else. to me it looks like there must be something in wordpress that is saying use home.php
  3. Hi have a webpage (homepage) that has a wordpress blog linked to it. when i save the page exactly as it is for example. home.php then saves as home1.php and load the home1.php the wordpress blog is missing. i dont use wordpress normally this is a site i have been sent to amend some part in php. Is the reason for this wordpress backend is pointing to the home.php? here is the code for the blog <div class="blog_container"> <a href="/blog" class="title_link">Latest Blog Posts</a> <? if ($posts) { ?> <ul> <? foreach ($posts as $post) { ?> <li> <a href="<?= $post->guid ?>"> <?= word_limiter($post->post_title, 10) ?> <span><?= date('d-m-Y', strtotime($post->post_date)) ?></span> <strong>read more ></strong> </a> </li> <? } ?> </ul> <? } ?> </div> thanks
  4. i am trying WHERE DATE_FORMAT(host_payments2014.payment_paid_timestamp, '%m/%d/%y') >= '2014-06-12' but am getting an error from another part of the page. Warning: Division by zero in the line of code is. $additional1 = $row_rsPayment['payment_amount_paid'] / $row_rsPayment['rental_price']; // divide this by property week amount ;
  5. yes it currently is stored as VARCHAR, i need to change it to DATE but this issue i am having is the return date from the bank is MM/DD/YY and the date format is 0000-00-00 in phpMyAdmin and i not sure if the return date will populate the column correctly.
  6. i have a table that shows payments made but want to the payments only showing from a set date(06/12/14) and before this date i dont want to show this is my sql that doesnt seem to work and is showing dates before the specified date. . "SELECT * FROM payments2014, signup2014, editprop2014 WHERE signup2014.userid = payments2014.payment_userid AND editprop2014.prop_id = signup2014.prop_id AND signup2014.userid !='page1' AND signup2014.userid !='page6' AND signup2014.userid !='page4' AND payments2014.payment_transaction_status !='none' AND payments2014.payment_transaction_status !='CANCELLEDa' AND payments2014.payment_type !='deposit' AND payments2014.payment_paid_timestamp NOT LIKE '%2012%' AND payments2014.payment_paid_timestamp NOT LIKE '%2011%' AND payments2014.payment_paid_timestamp >= '06/12/14' ORDER BY payments2014.payment_id DESC" i have some other parts in the statment but this one that should be filtering is host_payments2014.payment_paid_timestamp >= '06/12/14' thanks in advance
  7. hello thanks for the help i have tried the following now <form id="form1" name="form1" method="GET" action=""> <label for="select"></label> <select name="select" id="select"> <?php do { ?> <option value="<?php echo $row_rsCountries['stockistLocID']?>"><?php echo $row_rsCountries['stockistLocName']?></option> <?php } while ($row_rsCountries = mysql_fetch_assoc($rsCountries)); $rows = mysql_num_rows($rsCountries); if($rows > 0) { mysql_data_seek($rsCountries, 0); $row_rsCountries = mysql_fetch_assoc($rsCountries); } ?> </select> <input type="submit" name="button" id="button" value="go" /> </form> and the query i have done is $var1_rsStockists = "-1"; if (isset($_GET['recordID'])) { $var1_rsStockists = $_GET['recordID']; } mysql_select_db($database_beau, $beau); $query_rsStockists = sprintf("SELECT * FROM beauAW13_stockist, beauAW13_stockistLoc WHERE beauAW13_stockist.stockistLocID = beauAW13_stockistLoc.stockistLocID AND beauAW13_stockistLoc.stockistLocID = %s", GetSQLValueString($var1_rsStockists, "int")); $rsStockists = mysql_query($query_rsStockists, $beau) or die(mysql_error()); $row_rsStockists = mysql_fetch_assoc($rsStockists); $totalRows_rsStockists = mysql_num_rows($rsStockists); mysql_select_db($database_beau, $beau); $query_rsCountries = "SELECT * FROM beauAW13_stockistLoc"; $rsCountries = mysql_query($query_rsCountries, $beau) or die(mysql_error()); $row_rsCountries = mysql_fetch_assoc($rsCountries); $totalRows_rsCountries = mysql_num_rows($rsCountries); but when the form is submitted no information is returned
  8. I have dynamic select list that is populated with countries (each country has information (shops) that is associated it. When the country is selected i want the shop information to show below then menu. the statement for the shop is mysql_select_db($database_beau, $beau); $query_rsStockists = "SELECT * FROM beauAW13_stockist, beauAW13_stockistLoc WHERE beauAW13_stockist.stockistLocID = beauAW13_stockistLoc.stockistLocID"; $rsStockists = mysql_query($query_rsStockists, $beau) or die(mysql_error()); $row_rsStockists = mysql_fetch_assoc($rsStockists); $totalRows_rsStockists = mysql_num_rows($rsStockists); mysql_select_db($database_beau, $beau); $query_rsCountries = "SELECT * FROM beauAW13_stockistLoc"; $rsCountries = mysql_query($query_rsCountries, $beau) or die(mysql_error()); $row_rsCountries = mysql_fetch_assoc($rsCountries); $totalRows_rsCountries = mysql_num_rows($rsCountries); the select list is <form id="form1" name="form1" method="post" action=""> <label for="select"></label> <select name="select" id="select"> <?php do { ?> <option value="<?php echo $row_rsCountries['stockistLocID']?>"><?php echo $row_rsCountries['stockistLocName']?></option> <?php } while ($row_rsCountries = mysql_fetch_assoc($rsCountries)); $rows = mysql_num_rows($rsCountries); if($rows > 0) { mysql_data_seek($rsCountries, 0); $row_rsCountries = mysql_fetch_assoc($rsCountries); } ?> </select> <input type="submit" name="button" id="button" value="go" /> </form> and the shop information that i want to appear below is <p><?php echo $row_rsStockists['stockistName']; ?><br /> <?php echo $row_rsStockists['stockistAdd1']; ?><br /> <?php echo $row_rsStockists['stockistTown']; ?><br /> <?php echo $row_rsStockists['stockistCounty']; ?><br /> <?php echo $row_rsStockists['stockistCountry']; ?><br /> <?php echo $row_rsStockists['stockistPostCode']; ?><br /> <?php echo $row_rsStockists['stockistWWW']; ?></p> thanks for you help in advance
  9. sorry a bit vague, yes there is no output yes all the IDs are corrected and the tables are related..
  10. sorry, yes that is the value from the select list.it is put into an array that is in the code above $XC_BindingValues=array("size2","ProductID","size2","1","Product","Price","Stock","");
  11. yes i get that bit but need to know how to make that query to get all the data based on that $XCart_StockID variable
  12. thanks here is the product description page. including the select list that needs to pass the stockID // *** X Shopping Cart *** $useSessions = false; $XCName = "mejobbo"; $XCTimeout = 1; $XC_ColNames=array("StockID","ProductID","Size","Quantity","Name","Price","Stock","Total"); $XC_ComputedCols=array("","","","","","","","Price"); require_once('XCInc/XCart.inc'); $var1_rsProduct = "-1"; if (isset($_GET['productID'])) { $var1_rsProduct = $_GET['productID']; } mysql_select_db($database_mejobbo, $mejobbo); $query_rsProduct = sprintf("SELECT * FROM mejobboAW13_Cat, mejobboAW13_products, mejobboAW13_Stock, mejobboAW13_SizeList WHERE mejobboAW13_products.catID = mejobboAW13_Cat.catID AND mejobboAW13_products.ProductID = mejobboAW13_Stock.ProductID AND mejobboAW13_Stock.SizeID = mejobboAW13_SizeList.SizeID AND mejobboAW13_products.ProductID = %s AND mejobboAW13_Stock.Stock != 0 ", GetSQLValueString($var1_rsProduct, "int")); $rsProduct = mysql_query($query_rsProduct, $mejobbo) or die(mysql_error()); $row_rsProduct = mysql_fetch_assoc($rsProduct); $totalRows_rsProduct = mysql_num_rows($rsProduct); // *** Add item to Shopping Cart via form *** $XC_editAction1 = $_SERVER["PHP_SELF"]; if (isset($_SERVER["QUERY_STRING"])) $XC_editAction1 = $XC_editAction1 . "?" . $_SERVER["QUERY_STRING"]; if (isset($_POST["XC_addToCart"]) && $_POST["XC_addToCart"] == "form1") { $NewRS=mysql_query($query_rsProduct, $mejobbo) or die(mysql_error()); $XC_rsName="rsProduct"; // identification $XC_uniqueCol="ProductID"; $XC_redirectTo = ""; $XC_redirectPage = "../cart1.php"; $XC_BindingTypes=array("FORM","RS","FORM","LITERAL","RS","RS","RS","NONE"); $XC_BindingValues=array("size2","ProductID","size2","1","Product","Price","Stock",""); $XC_BindingLimits=array("","","","","","","",""); $XC_BindingSources=array("","","","","","","",""); $XC_BindingOpers=array("","","","","","","",""); require_once('XCInc/AddToXCartViaForm.inc'); } and the form <form action="<?php echo $XC_editAction1; ?>" method="post"> <select name="select" id="select"> <?php do { ?> <option value="<?php echo $row_rsProduct['StockID']; ?>"><?php echo $row_rsProduct['Size']?></option> <?php } while ($row_rsProduct = mysql_fetch_assoc($rsProduct)); $rows = mysql_num_rows($rsProduct); if($rows > 0) { mysql_data_seek($rsProduct, 0); $row_rsProduct = mysql_fetch_assoc($rsProduct); } ?> </select> <input type="image" src="../images/SS13AddToCart.jpg" border="0" name="submit"/></p> <input type="hidden" name="XC_recordId" value="<?php echo $row_rsProduct['ProductID']; ?>" /> <input type="hidden" name="XC_addToCart" value="form1" /> </form> then the page this is sent to is cart1.php // *** X Shopping Cart *** $useSessions = false; $XCName = "mejobbo"; $XCTimeout = 1; $XC_ColNames=array("StockID","ProductID","Size","Quantity","Name","Price","Stock","Total"); $XC_ComputedCols=array("","","","","","","","Price"); require_once('XCInc/XCart.inc'); then i tried a query to get the StockID details mysql_select_db($database_mejobbo, $mejobbo); $query_rsSize = "SELECT * FROM mejobboAW13_Stock, mejobboAW13_SizeList WHERE mejobboAW13_Stock.SizeID = mejobboAW13_SizeList.SizeID AND mejobboAW13_Stock.StockID = '$XCart_StockID'"; $rsSize = mysql_query($query_rsSize, $beau) or die(mysql_error()); $row_rsSize = mysql_fetch_assoc($rsSize); $totalRows_rsSize = mysql_num_rows($rsSize); but this didn't work then to diplay in a table <?php while($XCart__i<sizeof(${$XCName}["contents"][0])) { require('XCInc/RepeatXCartRegion.inc'); ?> <tr class="text"> <td><input name="Quantity[]" type="text" value="<?php echo $XCart_Quantity = ${$XCName}["contents"][3][$XCart__i]; ?>" size="2" maxlength="2" /></td> <td><?php echo $XCart_Name = ${$XCName}["contents"][4][$XCart__i]; ?></td> <td><?php echo $XCart_StockID = ${$XCName}["contents"][0][$XCart__i]; ?></td> <td><?php echo $XCart_Size = ${$XCName}["contents"][2][$XCart__i]; ?><?php echo $row_rsSize['Size']; ?></td> <td><?php echo DoFormatCurrency($XCart_Price = ${$XCName}["contents"][5][$XCart__i], 2, ',', '.', '£ ', ''); ?></td> <td><?php echo DoFormatCurrency($XCart_Total = ${$XCName}["contents"][7][$XCart__i], 2, ',', '.', '£ ', ''); ?></td> <td><input type="checkbox" name="xdelete<?php echo $XCart__i; ?>" value="1" /></td> </tr> <?php $XCart__i++; Next(${$XCName}["contents"][0]); } ?> is this what you asked for, thanks
  13. i have a variable that is passed from a select list, the value of the select list is a stockID <?php echo $XCart_StockID = ${$XCName}["contents"][0][$XCart__i]; ?> this is constructed from an array $useSessions = false; $XCName = "mejobbo"; $XCTimeout = 1; $XC_ColNames=array("StockID","ProductID","Size","Quantity","Name","Price","Stock","Total"); $XC_ComputedCols=array("","","","","","","","Price"); require_once('XCInc/XCart.inc'); i have a tables that contains joined references mejobbo_products ----------------------------- ProductID the stock table mejobbo_Stock ----------------------------- StockID ProductID SizeID and the size table mejobbo_SizeList ----------------------------- SizeID Size i need to know how to get all the data from table mejobbo_Stock based on the <?php echo $XCart_StockID; ?> variable thanks
  14. hi, thanks for you response i have tried your suggestion but and not getting the results. i have put in my workings $colname_rsCustomer = "-1"; if (isset($_SESSION['MM_Username'])) { $colname_rsCustomer = $_SESSION['MM_Username']; } mysql_select_db($database_cfs, $cfs); $query_rsCustomer = sprintf("SELECT * FROM cfsCustomers, cfsCustomersImages WHERE custEmail = %s AND cfsCustomersImages.custID = cfsCustomers.custID", GetSQLValueString($colname_rsCustomer, "text")); $query_limit_rsCustomer = sprintf("%s LIMIT %d, %d", $query_rsCustomer, $startRow_rsCustomer, $maxRows_rsCustomer); $rsCustomer = mysql_query($query_limit_rsCustomer, $cfs) or die(mysql_error()); $row_rsCustomer = mysql_fetch_assoc($rsCustomer); mysql_select_db($database_cfs, $cfs); $query_rsCount = sprintf("SELECT COUNT(*) FROM cfsCustomers, cfsCustomersImages WHERE cfsCustomers.custID = cfsCustomersImages.custID AND custEmail = %s AND imageWANT = 'Y'", GetSQLValueString($colname_rsCustomer, "text")); $rsCount = mysql_query($query_rsCount, $cfs) or die(mysql_error()); $row_rsCount = mysql_fetch_assoc($rsCount); $totalRows_rsCount = mysql_num_rows($rsCount); and echoing out the results <?php echo $row_rsCount['imageWant']; ?> basically i was trying to get the results based on the logged in user
  15. i have a table (cfsCustomersImages) containing the columns imagesID image custID imageWant the value of column imageWant is default "N" if the user wants and image they have a form they can check to change the value to "Y" what i need to show is a value of the total of "Y" values in the column for example if 6 "Y"'s are in the columns 6 images have been selected does this make sense?
  16. thanks for you help so far, ok i followed the example to see what i results i got this is where the data is pulled from 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) or die(mysql_error()); while($row_rsVoucher = mysql_num_rows($rsVoucher)){ echo $row_rsVoucher['VCode']; echo "<br/>"; } $totalRows_rsVoucher = mysql_num_rows($rsVoucher); voucher code // voucher code if (isset($_POST['vouchCode']) && $_POST['vouchCode'] == $row_rsVoucher['VCode']) { $mycode = $row_rsVoucher['VCode']; $spos = strpos($mycode, "f"); if ($spos !== false) { $myvalue = substr($mycode, $spos+1); $myvalue = $XCart_sumTotal * $myvalue / 100; } else { $spos = strpos($mycode, "p"); if ($spos !== false) { $myvalue = substr($mycode, $spos+1); } } $myTotal = $XCart_sumTotal - $myvalue; $_SESSION['vouchCode'] = $myvalue; } else unset($_SESSION['vouchCode']); the form that validates <form action="<?php echo $editFormAction; ?>" method="post" name="form2" id="form2"> <tr> <td class="mediumPinkHeaders">Voucher Code:</td> <td><input type="text" name="vouchCode" value="<?php echo @$_POST['vouchCode']; ?>" size="32" /></td> <td><input type="submit" value="update" /></td> </tr> </form> the echoed results <?php echo DoFormatCurrency($myvalue, 2, ',', '.', '£ ', ''); ?> so i tried another code that is 2nd in the database and got the following (lottiep3) <?php echo $myvalue ?> shows nothing <?php echo $_POST['vouchCode']; ?> shows lottiep3 and <?php echo $row_rsVoucher['VCode']; ?> shows lot123p10 i nothing is shown from the echo echo $row_rsVoucher['VCode']; echo "<br/>"; so a bit stuck
  17. so you mean? 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); { while($row_rsVoucher = mysql_fetch_assoc($rsVoucher)); } $totalRows_rsVoucher = mysql_num_rows($rsVoucher);
  18. oh so i need to add a loop here, is that correct?
  19. hello sorry about that i will include that part of the script 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); what is happening is i have echoed out <?php echo $myvalue ?><br /> <?php echo $_POST['vouchCode']; ?><br /> <?php echo $row_rsVoucher['VCode']; ?> <br /> the <?php echo $row_rsVoucher['VCode']; ?> is always showing the lot123p5 which is the first record on the DB when i submit the value lot123p5 i get the following <?php echo $myvalue ?> shows 5 <?php echo $_POST['vouchCode']; ?> shows lot123p5 and <?php echo $row_rsVoucher['VCode']; ?> shows lot123p5 so thats working when i try the percentage and submit lot123f10 i get the following <?php echo $myvalue ?> shows nothing <?php echo $_POST['vouchCode']; ?> shows lot123f10 and <?php echo $row_rsVoucher['VCode']; ?> shows lot123p5 and therefor isnt working i have added another discount code to the £ discount to see if it was and issue with % lottiep3 to show £3 discount but that isnt working either so the script must only be calling the first record in the database
  20. Hello i have a discount code the partly works but does not fully do what i want it too. The way i have set this up is in the backend of the site i can add my own discount codes with the following rules - we have a % and a value, in this case £ the % is represented by f and the £ = p so when ever you make a new code you enter either f or p followed by the value of the discount so examples for testing i have lot123p5 ( this is £5 off ) or lot123f10 ( this 10% off ) the voucher code is as follows // voucher code if (isset($_POST['vouchCode']) && $_POST['vouchCode'] == $row_rsVoucher['VCode']) { $mycode = $row_rsVoucher['VCode']; $spos = strpos($mycode, "f"); if ($spos !== false) { $myvalue = substr($mycode, $spos+1); $myvalue = $XCart_sumTotal * $myvalue / 100; } else { $spos = strpos($mycode, "p"); if ($spos !== false) { $myvalue = substr($mycode, $spos+1); } } $myTotal = $XCart_sumTotal - $myvalue; $_SESSION['vouchCode'] = $myvalue; } else unset($_SESSION['vouchCode']); 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; } What seems to be happening is it is only reading the first record in the database, therefore not allowing me to add any more discounts.
  21. ok i was using dreamweaver and it had the save Byte Order Mark ticked. I now longer have the error but my script isn't working for the discount script
  22. i dont appear to have anything before the <?php tag a i have tried both <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> and <meta http-equiv="Content-Type" content="text/html; charset= "utf8_general_ci" /> but both are returning the same errors
  23. one line down Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 5 Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 6 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in/homepages/6/d330188495/htdocs/beta/XCInc/XCart.inc on line 4
  24. I have been looking through the forum regarding this a alot of peoples problems are white space or the session needs to go at the top of the page before ANYTHING else. i am getting the following errors Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 2 Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 3 Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 4 Warning: Cannot modify header information - headers already sent by (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/shopping-cart.php on line 5 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /homepages/6/d330188495/htdocs/beta/shopping-cart.php:1) in /homepages/6/d330188495/htdocs/beta/XCInc/XCart.inc on line 4 the code i have in the page is (starting at line 1) <?php require_once('Connections/lotties.php'); header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } 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")); mysql_select_db($database_lotties, $lotties); $Result1 = mysql_query($updateSQL, $lotties) or die(mysql_error()); } // *** X Shopping Cart *** $useSessions = true; $XCName = "LottieJakeCart"; $XCTimeout = 30; $XC_ColNames=array("ProductID","Quantity","Name","Price","Stock","Total"); $XC_ComputedCols=array("","","","","","Price"); require_once('XCInc/XCart.inc'); 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); // *** Update contents of Shopping Cart *** require_once('XCInc/XCupdateAction.inc'); if (isset($_POST["Quantity"])) { $XC_UpdateRedirect = "shopping-cart.php"; $values = $_POST["Quantity"]; require_once('XCInc/UpdateXCart.inc'); } // *** Empty XCart *** if (isset($_SERVER["QUERY_STRING"])) { $XC_EmptyCartLink = $_SERVER["PHP_SELF"] . "?" . htmlentities($_SERVER["QUERY_STRING"]) . "&XC_EmptyCart=1"; } else { $XC_EmptyCartLink = $_SERVER["PHP_SELF"] . "?XC_EmptyCart=1"; } if (isset($_GET["XC_EmptyCart"]) && ($_GET["XC_EmptyCart"] == "1")) { $XC_EmptyCartRedirect = "shopping-cart.php"; require_once('XCInc/XCemptyRedirect.inc'); } // *** Repeat XCart region *** (do not remove this label) // voucher code if (isset($_POST['vouchCode']) && $_POST['vouchCode'] == $row_rsVoucher['VCode']) { $mycode = $row_rsVoucher['VCode']; $spos = strpos($mycode, "c"); if ($spos !== false) { $myvalue = substr($mycode, $spos+1); $myvalue = $XCart_sumTotal * $myvalue / 100; } else { $spos = strpos($mycode, "p"); if ($spos !== false) { $myvalue = substr($mycode, $spos+1); } } $myTotal = $XCart_sumTotal - $myvalue; $_SESSION['vouchCode'] = $myvalue; } else unset($_SESSION['vouchCode']); 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; } ?> the code is the shopping cart with the ability to add a discount vouchers for example lot123p10 would be %10 of the total can anyone see what i am doing wrong? thanks in advance
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.