Try this method of updating
HI,
This MAY work for you. I've used similar code to reset numbers or coupon use's. Make sure that the coup_use table is set to INT and that you are using POST and are submitting off the button the user presses to use the coupon. You may have to play with it a bit. Let me know how it worked..or not.
<?php
// This is just a php page with no html and will process the coupon request, update the db and send the user where they need to go. You could call it update_coup.php
cart.php = $WA_redirectURL; // where ever the user needs to end up if success
require_once("Connections/your_db_file.php); // include the Connection file
if (!session_id()) session_start(); // make sure a Session is started
if (isset($_POST["submit"])) // Trigger - Make sure the form is set to POST as a method and this page as the action
{
$id = $_SESSION['VisitorID'];
$WA_connectionDB = $database_connCedar;
mysql_select_db($WA_connectionDB, $WA_connection);
$Sql = "UPDATE visitors SET visitors.coup_use = visitors.coup_use+1 WHERE visitor.VisitorID = $id";
$query = mysql_query($Sql, $WA_connection) or die(mysql_error());
$row = mysql_fetch_assoc($query);
}
if($row =< 3) {
header("Location: ".$WA_redirectURL);
} elseif($row > 3) {
header("Location: sorry.php");// or where ever the over the limit page is.
}
?>
Best,
Jay