How to give single quotes in SQL Query using yii frameowrk?
I'm trying to execute following SQL query using YII frameowrk
Query= select * from table where name='Bachelor''s degree'
By executing the above query I'm getting empty results. But I have content in tables.
From my perspective I think Yii framework not accepts query with single quotes in its contents.
So could you please suggest some other idea to resolve this issue ?
Thanks in advance.
用参数尝试查询。
$name = "Bachelor's degree";
Yii::app()->db->createCommand()
    ->select()
    ->from('table_name')
    ->where('name = :name', array(':name' => "{$name}"))
    ->queryAll();
以YII方式,将您的价值与声明联系起来。
    $name = "Bachelor's degree";
    $command=Yii::app()->db->createCommand();
    $command->select('table_column1,table_column2,table_column3');
    $command->from('table');
    $command->where('name=:name', array(':name'=>$name));
    echo $command->queryAll();
