Number not incrementing in PHP -


i'm trying value db , incrementing number.

my code:

public function updatestat($res, $id) {     $field = ($res == 'useful') ? 'useful' : 'not_useful';      $currstat = $this->_db->query("select {$field}          vragen id = {$id}");      $currstat = ($field == 'useful') ?          $currstat->first()->useful :          $currstat->first()->not_useful;      $currstat++;      die($currstat);      $data = $this->_db->query("update vragen          set {$field} = {$currstat} id = {$id}"); } 

there's no output when dying this.

you can improve , simplify code. replace select + update update:

public function updatestat($res, $id) {     $data = $this->_db->query("update vragen set {$field} = {$field} + 1          id = {$id}"); } 

Comments