I have below code:
$inputs = "1,2,3,4,5";
$sql = "SELECT * FROM obj WHERE id IN(:input)";
$commond = Yii::app()->db->createCommand($sql);
$commond->bindValue(":input", $inputs , PDO::PARAM_STR);
But the query result is incorrect. How to bind params for such IN
condition?
for now use it like this
$command = Yii::app()->db->createCommand()
->select()
->from('tableName')
->where(array('in', 'id', explode(',', $inputs)));
I ll try to get back with $command->bindValue()
method.