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 | 4079 views | 18 replies

jstoler155201

Here's an idea for limiting coupons

You will have to add an extra row to the Users table in the DB. Something like coup_use.

Then when a coupon is used there will have to be an an if/else function applied to the Users table after you call it up in a SELECT * from Users recordset.

1. Check and see if the coupon has been used before.
2. If yes is it < 3.
3. if yes, the coupon gets an UPDATE applied and then is sent to the cart or checkout where they can see the discount.
4. If no, then you have to redirect to Sorry page that says Sorry, over the limit or something like that.

It might look something like this in theory.

if($coup_use != "") {
if($coup_use <3) {
echo header("Location: update.php")
} else {
echo header("Location: sorry.php")
}
}

The update page would just be code, something like SET Users.coup_use ++ and then redirect to cart or payoff page.

Also, make sure the coup_use table is set to NULL when users sign up for the first time.

There may be easier ways, but this is what I would do.

Hope you find it useful.
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...