Can we fire database query while flagging the node? Can we fire  database query on flagging the flag(pick_this_bid)
I want to update the database table column in which boolen value is saved true and false.

By default it shows true status in database but when someone flagged(pick_this_bid) the  status  should change to false in the database.

I want something like this on clicking flag how to achieve this?

if(status==1)
 $status=0;
 else
  $status=1;

UPDATE  `my_table`.`node` SET  `status` =  0 WHERE  ` node`.`nid`    =1059;
According to The Flag 3.x API (PHP)


mymodule_flag_flag($flag, $content_id, $account, $flagging) {
  // Do something in response to the flagging.
}

mymodule_flag_unflag($flag, $content_id, $account, $flagging) {
  // Do something in response to the unflagging.
}



In your case

mymodule_flag_flag($flag, $content_id, $account, $flagging) {

  if ($flag-&gt;name == 'pick_this_bid'){

     $nid = $content_id;
     db_update('my_table')
       -&gt;expression('status', '0')
       -&gt;condition('nid', $nid)
       -&gt;execute();
  }

}