gpt4 book ai didi

php - 使用zend的Mysql删除查询

转载 作者:行者123 更新时间:2023-11-29 10:55:26 25 4
gpt4 key购买 nike

我正在开发一个应用程序,其中有一个函数(正确调用)可以接收 id,并且应该从存在 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);

关于php - 使用zend的Mysql删除查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43111327/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com