I do a command like this:
$db = new \yii\db\Connection([ 'dsn' => 'mysql:host=localhost;dbname=cms', 'username' => 'root', 'password' => '', 'charset' => 'utf8', ]); db()->createCommand("UPDATE `cms_profile` SET `UserName`='$model->Fname $model->Lname',`Mobile1`=$model->Mobile,`Mail`='$model->Mail',`ProfileImg`='db.jpg' WHERE `Mail`='$this->Mail'")->execute(); How to use the native connection to the database specified in the framework config instead of creating the $ db object?
Yii::$app->db->createCommand()->execute()or are youYii::$app->db->createCommand()->execute()about? yiiframework.com/doc-2.0/… - Roman GrinyovcreateCommand()? - Roman Grinyov