createCommand &#039 is appending to query generating Database exception

Below is my query:


 \Yii::$app->db->createCommand("INSERT INTO `schoolwall-10` SELECT FROM `schoolwall-50` WHERE ID=149")->execute();

It is giving me Exception (Database Exception) with the following query:


INSERT INTO `schoolwall-10` SELECT FROM `schoolwall-50` WHERE ID=149&#039 

Why is single quote html-character(&#039) appending to the query? Can anyone please help.

[font="Times New Roman"][size="6"]Hi ,[/size][/font]

[font="Verdana, sans-serif"] [/font]

[size=2][font=“Times New Roman”]& #039; [/font][/size][font=“Verdana, sans-serif”][size=“2”]becomes ’ (single quote).[/size][/font]

[font="Verdana, sans-serif"] [/font]

[font="Verdana, sans-serif"][size="2"]Please make sure before writing the query that single quote is appending to your query.[/size][/font]

[font="Verdana, sans-serif"] [/font]

[font=“Verdana, sans-serif”][size=“2”]But my personal suggestion is don’t write insert query simply use[/size][/font]

[font="Verdana, sans-serif"] [/font]

[font="Verdana, sans-serif"][size="2"]




$model = new yourModel();

$model->yourfield = 'your_value';

$model->save(); //If you want to save without validation simply $model->save(false);



[/size][/font]

[font="Verdana, sans-serif"] [/font]

[font="Verdana, sans-serif"][size="2"]Cheers,[/size][/font]

[font="Verdana, sans-serif"][size="2"]Happy Coding.[/size][/font]