Welcome Guest, Not a member yet? Register   Sign In
Active record help
#1

[eluser]Unknown[/eluser]
I need to produce a where clause that looks like this:

WHERE messages.thread_id = 40 AND (messages.author = 10 or messages.recipient = 15)

I have tried where() and or_where but it produces
where messages.thread_id = 40 AND messages.author = 10 OR messages.recipient = 15

which of course does not give me the results I need.

Thanks!
#2

[eluser]danmontgomery[/eluser]
Code:
$this->db->where('messages.thread_id', 40);
$this->db->where('(`messages`.`author` = 10 OR `messages`.`recipient` = 15)', NULL, FALSE);
#3

[eluser]Unknown[/eluser]
Perfect, thanks.

Just before your reply I created a string and pasted that into the where(); Some results, but you solution is just 1 line so I will go with that!

Thanks Again!




Theme © iAndrew 2016 - Forum software by © MyBB