Michael D Sun Jun 10 07:17:41 -0400 2012

Subject: How to I write this sql?

I want to get results where requester_id = $this->user_id or receiver_id = $this->user_id and is_pending = 1;

I tried this:
$friends = Friend::find_all_by_requester_id_or_receiver_id_and_is_pending($this->user_id, $this->user_id, 1);

But I don't get the results I want.


Gareth Hall Wed Sep 12 00:11:29 -0400 2012

Try

$friends = Friend::find(
'all',
array(
'conditions' => array('(user_id = ? OR receiver_id = ? ) AND is_pending = ?', $theUserID, $theReceiverID, $isPending);
)
);

(1-1/1)