Mysql 使用 zend 删除查询

Mysql delete query using zend

我正在开发一个应用程序,其中有一个函数(正确调用)接收一个 id,应该从 table 存在该 id 的地方删除记录。

这是我的代码:

public function deleteAction($id) {
        if ($id) {
            $where[] = $this->_db->quoteInto('transazione = ?', $id);
            $this->_db->delete($this->_name, $where);   
        }
    }

该函数已正确调用,但我收到此错误:

An error occurred

SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ')' at line 1

我该如何解决这个问题?

尝试

   $n = $this->_db->delete('tablename', "column_id = $id");
        /*or*/ 
   $q = $this->_db->quoteInto('DELETE * FROM bugs WHERE reported_by = ?', $id);
   $this->_db->query($q);