How to increment an integer field in SQLite?

Neither of the following will work:

“UPDATE choices SET votes=(votes + 1) WHERE poll_id=? && choice_id=?”

“UPDATE choices SET votes=increment(votes) WHERE poll_id=? && choice_id=?”

Thanks in advance! :slight_smile:

votes=votes + 1

Thanks. Is that an UPDATE, SELECT, or what? As I said, I tried that (with parentheses) in an UPDATE statement, but it didn’t work.

it should work

run this code out of php

UPDATE choices SET votes=votes + 1 WHERE poll_id=? AND choice_id=?

notice the && in sql is AND

Okie doke. The “&&” never broke a statement before, but I’ll change it anyway. Thanks again!

The problem actually appears to be a defective PHP client or PDO driver. The statement executes just fine from Lita.