gpt4 book ai didi

php - 我无法使用 codeigniter 从 mysql 中删除

转载 作者:行者123 更新时间:2023-11-28 23:39:54 27 4
gpt4 key购买 nike

我无法使用 codeigniter 从 MySQL 中删除。

我的 Controller :

public function delete($id)
{
$this->load->model('dele');
$this->dele->delettest($id);
}

和我的模型:

    $this->db->where('id', $id);
$this->db->delete('table');

但记录并没有被删除。

最佳答案

没有模型。尝试在您的 Controller 中执行此操作:

public function delete($id) { 
$this->db->delete('your_table', array('id' => $id)); //pass here the array with $id
}
/*
It will produce:
DELETE FROM your_table
WHERE id=1;
*/

关于php - 我无法使用 codeigniter 从 mysql 中删除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34699089/

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