代码点火器查询:如何构建此查询 [英] code igniter queries: how to build this query

查看:62
本文介绍了代码点火器查询:如何构建此查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用代码igniter的活动记录类构建一个查询,如下所示:



SELECT *从account = 1和(fname像'k%'或lname像'k%')



但是我不知道如何使用函数

解决方案

您也可以使用like query

  $ this-> db-> like('title','match'); 

//产生:WHERE title LIKE'%match%'

or_like

  $ this-> db-> like('title','match'); 
$ this-> db-> or_like('body',$ match);


I am attempting to build a query using code igniter's active records class that looks like this:

SELECT * from contacts where account = 1 and (fname like 'k%' or lname like 'k%')

however I am not sure how to use the functions to do this.

and ideas?

解决方案

You can also use the like query

$this->db->like('title', 'match');

// Produces: WHERE title LIKE '%match%' 

And or_like

$this->db->like('title', 'match');
$this->db->or_like('body', $match); 

这篇关于代码点火器查询:如何构建此查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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