Yii compare suffix of domains

63 views Asked by At

I need to compare suffix of domains using yii CActiveDataProvider

somthing like: display all domains with suffix of .com where google.com = .com

for example i am trying this (but both of them not working):

'criteria'=>array(    
'condition' => 'domain=:id', 
    'params' => array(':id' => '.com' ),
)

or

 'criteria'=>array(
        'condition' => "strstr(domain, '.') = .com", 
)

what i need to do to get it works?

1

There are 1 answers

0
Haneev On

You can use MySQL LIKE syntax

'condition' => "domain LIKE CONCAT('%', :id)",
'params' = array('id' => '.com')