Yii, update record (update query) method

Update By Primary KeyModel::model()->updateByPk($Model->id,array(“status”=>’ok’)); Update All RowsModel::model()->updateAll(array(‘user’=>”$userid”,’date’=>$currenttime),”status=>’ok'”);

yii, handling image uploads

In Model file function rules() : <?phparray(‘product_image_1, product_image_2, product_image_3’, ‘file’, ‘types’=>’jpg, gif, png’, ‘allowEmpty’=>true),?> In View file set form like this : <div class=”form”><?php $form=$this->beginWidget(‘CActiveForm’, array( ‘id’=>’products-form’, ‘enableAjaxValidation’=>false, ‘htmlOptions’=>array(‘enctype’ => ‘multipart/form-data’))); ?> <p class=”note”>Fields with <span class=”required”>*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <div class=”row”> <?php echo $form->labelEx($model,’product_name’); ?> <?php echo $form->textField($model,’product_name’,array(‘size’=>60,’maxlength’=>255)); ?> <?php echo… Continue reading yii, handling image uploads