***** public function ajax_update () {$ this -> _ validate ();$ data = array ('CategoryId' => $ this-> input-> post ('CategoryName'), 'BrandName' => $ this-> input-> post ('BrandName'),);$ brand = $ this-> brand-> get_by_id ($ this-> input-> post ('BrandId'));if (! empty ($ _ FILES ['Brandlogo'] ['name'])) {$ upload = $ this -> _ do_upload ();$ data ['Brandlogo'] = $ upload;if (file_exists ('upload / brand /' .$ brand-> Brandlogo) && $ brand-> Brandlogo) {unlink ('upload / brand /'.$ brand-> Brandlogo);}} $ this-> brand-> update (массив ('BrandId' => $ this-> input-> post ('BrandId')), $ data);echo json_encode (array ("status" => TRUE));} публичная функция get_by_id ($ id) {$ this-> db-> select ('*') -> from ('brand') -> join ('category', 'category.CategoryId = brand.CategoryId');$ This-> db-> где ( 'BrandId', $ ID);$ query = $ this-> db-> get ();return $ query-> row ();} ------------------------------------------------------------------------ *****