views:

19

answers:

1

Hi, i am currently working on anppication where i need to increment a counter depending on date. i mean i want to send 3 sms per day. How can in implement this feature.

Thanks in advance.

A: 

You will need a database (or some other permanent way) to store the count, with columns like "account id", "date" and "count".

When the user wants to send an sms, get his record by his account id (whatever that is). Check the date from that record against the current date. When you get no record, that user never sent an sms. When the date is not the current date, the user didn't send anything today.

Else check the count.

After sending, update (or insert) the record with the new count and date.

Hans Kesting
Thanks a lot Hans Kesting.
Sujit