Welcome Guest, Not a member yet? Register   Sign In
Active Record T-Sql about OR
#1

[eluser]smartweb[/eluser]
Hi,

How to change the T-sql

SELECT * FROM (`cms_cates`) WHERE `id` = '130' OR `logics` LIKE '%,130,%'

to Active Record ?

I used

$this->db->like('logics', ",".$cid."," )
->or_where('id', $cid)
->get(`cms_cates`);

But the result is
SELECT * FROM (`cms_cates`) WHERE `id` = '130' AND `logics` LIKE '%,130,%'

I only want OR
#2

[eluser]bhumes[/eluser]
I think this should work:

Code:
$this->db->where('id',$cid);
$this->db->or_like('logics',','.$cid.',');
#3

[eluser]smartweb[/eluser]
your result is
SELECT * FROM (`cms_cates`) WHERE `id` = '130' AND `logics` LIKE '%,130,%'

But I want
SELECT * FROM (`cms_cates`) WHERE `id` = '130' OR `logics` LIKE '%,130,%'

I'm only want OR NOT AND.
#4

[eluser]bhumes[/eluser]
I did some digging, and I think this might be a bug. I created a new post in the bugs forum here.
#5

[eluser]smartweb[/eluser]
Thanks Bhumes,
#6

[eluser]osci[/eluser]
I didn't see the new topic in bugs. Post deleted - not needed




Theme © iAndrew 2016 - Forum software by © MyBB