One of my clients came to me today, saying he wants sort of a game integrated in his website as an incentive for his customers (members area).
What he would like is the following. On a page are about 500 squares in different colors. 20 of those squares should hold discount coupons. 10%, 15%, 20%, 25% etc. A price should be only awarded after a certain number of clicks (lets say 20 clicks). A member/customer has only 2 clicks a day. I have the customers table and I can think of a way to restrict a customers to 2 clicks a day. I’m only wondering how to set up the coupons table.
I know what you mean. These discounts are static values which I later only need to give those discounts. Maybe this question is better. Where I should store the number of clicks per square, before a discount is awarded! The squares will probably appear in a random positions.
depends on whether you are storing each square, or only those squares which actually have a discount in them, and also depends on how you are accomplishing this –
I have the customers table and I can think of a way to restrict a customers to 2 clicks a day.
That is my greatest dilemma. I am thinking about the first option. To have a table with all squares in it and just twenty that will hold an actual value:
CREATE TABLE IF NOT EXISTS `tblSqares` (
`square_id` int(3) NOT NULL auto_increment,
`square` varchar(12) default NULL,
`value` varchar(32) default NULL,
`clicks` int(2) NOT NULL default '20',
PRIMARY KEY (`square_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
That way I can decrease the click value for the squares that hold a value as well! I’m not sure how I would do that If I would output the squares dynamically.
What would be the most practical way in your opinion?