Esempio n. 1
0
 /**
  * @param string $table - table in witch we update data
  * @param array $data - associative array with data to update
  * @return DB object with part of the query
  */
 public static function update($table, $data)
 {
     foreach ($data as $key => $value) {
         if ($value == 'null') {
             $data[$key] = DB::expr('null');
         } else {
             $data[$key] = stripslashes($value);
         }
     }
     if (!isset($data['updated_at']) and Common::checkField($table, 'updated_at')) {
         $data['updated_at'] = time();
     }
     return DB::update($table)->set($data);
 }