/** * 更新记录 * * @param $table * @param $data * @param $condition * * @throws Exception * @return bool */ public static function update($table, $data, $condition, $db_conf = '') { global $_F; if (!$condition) { throw new Exception("FDB update need condition."); } // $c = ''; // if (is_array($condition)) { // foreach ($condition as $_k => $_v) { // $c .= " and {$_k}='{$_v}'"; // } // // $condition = ltrim($c, ' and'); // } if ($db_conf) { $table = new FTable($table, '', $db_conf); } else { $table = new FTable($table); } return $table->update($data, $condition); }
/** * 更新记录 * * @param $table * @param $data * @param $condition * * @throws Exception * @return bool */ public static function update($table, $data, $condition) { global $_F; if (!$condition) { throw new Exception("FDB update need condition."); } $c = ''; if (is_array($condition)) { foreach ($condition as $_k => $_v) { $c .= " and {$_k}='{$_v}'"; } $condition = ltrim($c, ' and'); } $table = new FTable($table); return $table->update($data, $condition); }
public function updateAction() { $c_uid = trim(FRequest::getString("c_uid")); $ver = FRequest::getInt("ver"); $status = FRequest::getInt("status"); $c_sid = trim(FRequest::getString("c_sid")); $data = array('status' => $status); $where = array('ver' => $ver, 'c_uid' => $c_uid, 'c_sid' => $c_sid); $t = new FTable("app_version"); $t->update($data, $where); FResponse::output(CommonUtil::GetDefRes(200, "操作成功")); return; }