function update() { $offers = new Offers(); $get_edited = array(); $_REQUEST['image'] = Sessions::getUploadedOfferImage(); foreach ($_REQUEST as $k => $v) { if ($v != "") { $get_edited[$k] = $v; } } $offers->setId($get_edited['offer_id']); $offers->setValues($get_edited); $offers->setFromDate(date('Y-m-d', strtotime($get_edited['from_date']))); $offers->setToDate(date('Y-m-d', strtotime($get_edited['to_date']))); if ($offers->update()) { //Sessions::setTourBannerId($get_edited['id']); Sessions::getUploadedOfferImage(''); Common::jsonSuccess("Offers Updated Successfully!"); } else { Common::jsonError("Error"); } }