我的模型(杰米Rumbelow) - 如何使用',其中'与模型 [英] My Model (by Jamie Rumbelow) - how to use 'where' with the model

查看:172
本文介绍了我的模型(杰米Rumbelow) - 如何使用',其中'与模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经集成了杰米Rumbelow我的模型做与codeigniter活动记录查询从github上 - 的 https://github.com/jamierumbelow/$c$cigniter-base-model

我想正常使用codeigniter语法做多参数的地方,但不知道如何使用标准codeigniter语法如下:

  $这个 - > DB-化合物其中(激活,1);
$这个 - > DB-化合物其中(类型,新闻);
 

任何人都可以提出如何利用这个MY_Model做?

比如......这个工作,但只允许一列和放大器;它的价值 - 我将如何做到这一点具有多个列和放大器;值

  $这个 - > news_model-> get_many_by(激活,1);
 

解决方案

排序它 - 对任何人有同样的问题 - 你需要传递一个数组

  $这个 - > news_model-> get_many_by(
          阵列(有效=大于1,'another_column'=>'值')
        );
 

I have integrated the Jamie Rumbelow My Model for doing active record queries with codeigniter from github - https://github.com/jamierumbelow/codeigniter-base-model

I'd like to use the normal codeigniter syntax for doing a where with multiple parameters but not sure how to use the standard codeigniter syntax as follows :

$this->db->where('active', 1);
$this->db->where('type', 'news');

Can anyone suggest how this is done using this MY_Model?

For instance... this works but only allows for one column & its value - how would I do this with multiple columns & values

$this->news_model->get_many_by('active', 1);

解决方案

Sorted it - for anyone else having the same problem - you need to pass an array.

$this->news_model->get_many_by( 
          array('active' => 1, 'another_column'=> 'value')
        );

这篇关于我的模型(杰米Rumbelow) - 如何使用',其中'与模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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