我有一个简单的查询来删除mysql数据库中的记录。
以下是我的疑问:
$this->db->where('post_Id', $post_Id);
$result = $this->db->delete($this->mastables['post'],$post_Id);
return $result;我得到的是:
数据库错误发生错误号: 1054 从
tbl_post中删除'where子句‘中未知列'108’,其中post_Id= '108‘和108为NULL 文件名: C:\xampp\htdocs\socialsite\system\database\DB_driver.php 线路号码: 330
发布于 2015-02-13 10:51:06
修正了这段代码中的错误,有两个值传递给删除。因此,在$post_Id中删除$result是可行的。
$this->db->where('post_Id', $post_Id);
$result = $this->db->delete($this->mastables['post'],$post_Id);更新代码:
$this->db->where('post_Id', $post_Id);
$result = $this->db->delete($this->mastables['post']);发布于 2015-02-13 09:59:36
试试这个,它会有帮助的,没有必要还什么东西。
function delete($your_id)
{
    $this->db->where('your_tb_id',$your_id); //your_tb_id is key field in your table
    $this->db->delete('table_name');
}https://stackoverflow.com/questions/28496302
复制相似问题