SQLSTATE[HY000]: General error

$records = $this->db->fetchAll("UPDATE ".$table." SET views = views + 1 where id='".$itemid."'", Phalcon\Db::FETCH_ASSOC);

edited Sep '14

The SQL error means your MySQL connection was refused.

You should be using models to do this, you are all calling a fetch and doing an update,


class YourTable extends \Phalcon\Mvc\Model

    public function initialize()




public function indexAction() {

    // Find a record by the itemId (Not sure how you are getting it)
    $record = YourTable::findById($itemId);

    // Increment that record ID

    // Save it

    // To see the update:
    echo $record->views;