I’m new at Yii and I’m using the findAllBySql function to get some records.
$users = User::model()->findAllBySql("
SELECT *
FROM users u
WHERE replace(lower(u.firstname),' ','') LIKE '%:s%'
OR replace(lower(u.lastname),' ','') LIKE '%:s%'",
array(':s' => $search)
);
If I hardcode the value of :s, the function works correctly so it seems like Yii isn’t changing the parameter :s. Any help is greatly appreciated!
Regards,
Thijs
1 Answer