首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >删除记录时where子句代码点火器中的未知列

删除记录时where子句代码点火器中的未知列
EN

Stack Overflow用户
提问于 2015-02-13 09:28:13
回答 2查看 1.7K关注 0票数 1

我有一个简单的查询来删除mysql数据库中的记录。

以下是我的疑问:

代码语言:javascript
运行
复制
$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

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2015-02-13 10:51:06

修正了这段代码中的错误,有两个值传递给删除。因此,在$post_Id中删除$result是可行的。

代码语言:javascript
运行
复制
$this->db->where('post_Id', $post_Id);
$result = $this->db->delete($this->mastables['post'],$post_Id);

更新代码:

代码语言:javascript
运行
复制
$this->db->where('post_Id', $post_Id);
$result = $this->db->delete($this->mastables['post']);
票数 0
EN

Stack Overflow用户

发布于 2015-02-13 09:59:36

试试这个,它会有帮助的,没有必要还什么东西。

代码语言:javascript
运行
复制
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');
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/28496302

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档