Exemple #1
0
 /**
  * @Author: ANH DUNG Aug 05, 2014
  * @Param: $listId array id
  */
 public static function UpdateModelByListId()
 {
     $sql = '';
     $tableName = self::model()->tableName();
     $aRowInsert = array();
     if (isset($_POST['Listing']) && is_array($_POST['Listing']['contact_name_no'])) {
         foreach ($_POST['Listing']['contact_name_no'] as $key => $item) {
             $id = isset($_POST['Listing']['id'][$key]) ? $_POST['Listing']['id'][$key] : '';
             $item = MyFormat::removeBadCharacters($item, array('RemoveScript' => 1));
             if (!empty($id)) {
                 $sql .= "UPDATE {$tableName} SET " . " `contact_name_no`=\"{$item}\"  " . "WHERE `id`={$id} ;";
             }
         }
     }
     if (trim($sql) != '') {
         Yii::app()->db->createCommand($sql)->execute();
     }
 }