Increase the nr by 1 on database every time a purchase is made

Good day.
i would like if possible to increase a item baught nr when an item is baught.
let say i have an coffee shop and for what every coffe baught by the 5 coffe the 6th cofee is free. obvesiosly a data base of the client wil be on record also as when the client gets to the 12 cofee that one is free.
so its like this
iItem = 0
iItemCount = 6,12,18,24…
iItem = iItem ++ //When item is purchased

if iItem = iItemCount then
iItem = free
iItem = pay

so thus means the client can come back anyday and stil when the 6the “anycoffe” is baught then it would stil be free there for track should be kept and updated as the client baught the coffe or what ever Item

Did you checked this tutorial?

1 Like