function updatePosition() { $positionList = $this->input->post('positionList'); $idList = $this->input->post('idList'); $productCat = new productCat(); for ($i = 0; $i < count($idList); $i++) { $productCat->where("id", $idList[$i]); $productCat->get(); $productCat->position = $positionList[$i]; $productCat->save(); $productCat->clear(); } redirect("admin/productcats/listAll/" . $this->input->post('parentId')); }