Monday, April 9, 2012

Re: $condition and OR

Thanks a lot, it worked !

Le lundi 9 avril 2012 12:22:56 UTC+2, JonStark a écrit :
Hello every one.

I'm stuck with a little piece of code :

$condition = array('User.role' => 'admin'||'author');
    $this->set('users', $this->paginate('User', $condition));

It seems that OR (||) Isn't working with array... but I have a 3 role blog, and I want to regroup authors and admins on display :

$condition = array('User.role' => 'admin'||'author');
    $this->set('users', $this->paginate('User', $condition));
   
    $condition = array('User.role' => 'follower');
    $this->set('users_followers', $this->paginate('User', $condition));

How can this be solved ? Thanks again.

--
Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
 
 
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php

No comments: