我无法更新条件表中的特定字段。我的控制器是sitecontroller.php.Anybody帮帮我
Sitecontroler.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));
}
}
答案 0 :(得分:0)
未设置变量$connection
。
试试这个:
$connection=Yii::app()->db;
$command=$connection->createCommand($sql);