you never reset the button variable so after the first time it is always !=0
your also not keeping track of single pushes, the loop is running millions of times a second so if you printed out your counter to the serial monitor, I bet it skyrockets very quickly (use the serial monitor like it was your air supply when figuring things out!)
so in a practical application ... something like
// bytes are half the size of int's, but restricted to a max value of 255
byte button;
byte oldbutton = 0;
byte buttonpin = 2;
byte state = 0;
void setup()
{
pinMode(buttonpin, INPUT);
}
void loop()
{
digitalRead(buttonpin);
if(button && !oldbutton) // same as if(button == high && oldbutton == low)
{
//we have a new button press
if(state == 0) // if the state is off, turn it on
{
//do stuff
state = 1;
}
else // if the state is on, turn it off
{
//do stuff
state = 0;
}
oldbutton = 1;
}
else if(!button && oldbutton) // same as if(button == low && oldbutton == high)
{
// the button was released
oldbutton = 0;
}
}
PS: highlight your code and hit the # icon in the editor for future reference, it makes life much easier