Decreasing number in a field
I am having a program that connects to a database
Buttons are all disabled until the user logs in
I want:
When I press button 1 it decrease 1
When I press button 2 it decrease 1
When I press button 3 it decrease 2
If this field on the database is 0 user can't use the program
Re: Decreasing number in a field
Perhaps you could provide a little more information, like what language you're using and what database you're using. Small details but probably important.
Re: Decreasing number in a field
first off, your question is really vague and shows little effort on your part. That being said, I would first look into table normalization (just google it). you should never store calculated values in a table. instead, you would have several tables. in one of the tables you would store the total number of tries possible. in a second table, you would store each attempt. the tables would have an associated relationship via a foreign key. then, you would do the calculations in your sql select strings.