I'm trying to do a for loop where in it will count the number of times it will be clicked. For example I have a button where i can click that says purchase. Now, from there I want to restrict it by only once. One purchase and that's all he/she cant order or get the freebies again...
i thought of for loop cause it allows to count but then I wonder why on my second click it wont say "You can only avail one freebie for each item. Thank you."
for (int cclick=0; cclick<1; cclick++)
{
if (cclick==0)
{
globals.executesqlcom("insert into tblorders(cabin,seatnum1,seatnum2,item,price,qty) VALUES('" + globals.cabin + "','" + globals.seatnum1 + "','" + globals.seatnum2 + "','Travel toothbrush and toothpaste',.00,1" + ")");
MyMessage.showMessageDialog(this, "Freebies Added to Cart");
cclick = cclick + 1;
}
else
{
MyMessage.showMessageDialog(this, "You can only avail one freebie for each item. Thank you.");
}
}