close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Limit coupon use to three times?

Thread began 10/15/2009 9:00 am by bec341098 | Last modified 12/31/2009 11:51 am by bec341098 | 4081 views | 18 replies

jstoler155201

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

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...