SQLite/Notifier/Button not working the first time

I’ve had “problems” with if else (a long time ago) and these days with sqlite (days before the update the app just crashed and closed - it went back to work the other day).
So the first time the 2 selects return 1 ( number ) and still the "else’ block is executed (btn_gray) And in second the 2 selects return 1 ( number ) And (btn_blue) is executed ?