Quantcast
Channel: Yii Framework Forum
Viewing all articles
Browse latest Browse all 18717

findByAttributes()

$
0
0
I am trying to use this method to find an active record.

What I am looking for?
select * from tbl_user where username= {sameparam} or email= {sameparam};

I tried this:

$usermodel=User::model()->findByAttributes(array('username'=>$value, 'email'=>$value),$condition='or');

by default findByAttributes method performs an 'AND' operation, more like:
select * from tbl_user where username= {param} and email= {param};


any ideas?
Thank you.

Viewing all articles
Browse latest Browse all 18717

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>