如何在Codeigniter中的更新批处理中使用where条件 [英] How to use where condition in update batch in Codeigniter

查看:42
本文介绍了如何在Codeigniter中的更新批处理中使用where条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用

$this->db->update_batch('mytable', $data);

但是不知道如何在此update_batch中给出条件.我可以在哪里使用?

But Don't Know How to give condition in this update_batch. Can I use this where?

$this->db->where('id', Multiple Ids Here); 

推荐答案

我使用的代码与您的代码不同,但是可以正常工作,而且很容易理解,首先将此功能放入模型文件中即可.

i have code that is different from yours but it works and also it is easy to understand first put this function in your model file

在模型文件中

function updatedata($tbname, $data, $parm)
    {
        return $this->db->update($tbname, $data, $parm);    
    }

在控制器文件中的用法如下

in your controller file use like this

  $this->load->model("Your_model_name");    
  $this->Your_model_name->updatedata('mytable',$data,$your_condition_in_array);

我希望这会有所帮助,我确信此代码可以正常工作,请让我知道此代码适合您.

i hope this will help, i am sure about that this code works, please let me know that this code is worked for you.

这篇关于如何在Codeigniter中的更新批处理中使用where条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆