say, i am going to follow the good practice of avoiding sql injection. so this is not good:
$query="SELECT id,tag FROM tbl_tags WHERE tag LIKE '%".$tag."%' ORDER BY creation_time DESC LIMIT 0,10 ";
in stead i have to use parameter binding:
$query="SELECT id,tag FROM tbl_tags WHERE tag LIKE :tag ORDER BY creation_time DESC LIMIT 0,10 ";
$command =Yii::app()->db->createCommand($query);
$command->bindParam(":tag", "%{$tag}%", PDO::PARAM_STR);
$models = $command->queryAll();
But this generates: Fatal error: Cannot pass parameter 2 by reference
How can i bind this LIKE oriented parameter ?