无法使用 yii 框架更新具有条件的表中的点字段


Cant update perticular field in a table with condition using yii framework

我无法更新带有条件的表中的点字段。我的控制器是站点控制器.php.有人帮我

站点控制器.php

<?php
class SiteController extends Controller
  {
 public function actiondelete_resume()
   {
    $user_id = 97;   
    $sql = "UPDATE job_profile SET resume = '' WHERE user_id = $user_id";
    $command = $connection->createCommand($sql);
    $command->execute();
    $this->render('upload_new',array('model' =>$model));
   }
 }

变量$connection未设置。试试这个:

$connection=Yii::app()->db;
$command=$connection->createCommand($sql);