-1

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?

Swissa Yaakov
  • 186
  • 3
  • 15

1 Answers1

1

You can use MySQL LIKE syntax

'condition' => "domain LIKE CONCAT('%', :id)",
'params' = array('id' => '.com')
Haneev
  • 765
  • 5
  • 6